maximal_regression/
maximal_regression.rs1use automl::settings::*;
2use automl::*;
3
4fn main() {
5 let settings = Settings::default_regression()
7 .with_number_of_folds(3)
8 .shuffle_data(true)
9 .verbose(true)
10 .with_final_model(FinalModel::Blending {
11 algorithm: Algorithm::Linear,
12 meta_training_fraction: 0.15,
13 meta_testing_fraction: 0.15,
14 })
15 .skip(Algorithm::RandomForestRegressor)
16 .sorted_by(Metric::RSquared)
17 .with_preprocessing(PreProcessing::AddInteractions)
18 .with_linear_settings(
19 LinearRegressionParameters::default().with_solver(LinearRegressionSolverName::QR),
20 )
21 .with_lasso_settings(
22 LassoParameters::default()
23 .with_alpha(1.0)
24 .with_tol(1e-4)
25 .with_normalize(true)
26 .with_max_iter(1000),
27 )
28 .with_ridge_settings(
29 RidgeRegressionParameters::default()
30 .with_alpha(1.0)
31 .with_normalize(true)
32 .with_solver(RidgeRegressionSolverName::Cholesky),
33 )
34 .with_elastic_net_settings(
35 ElasticNetParameters::default()
36 .with_tol(1e-4)
37 .with_normalize(true)
38 .with_alpha(1.0)
39 .with_max_iter(1000)
40 .with_l1_ratio(0.5),
41 )
42 .with_knn_regressor_settings(
43 KNNRegressorParameters::default()
44 .with_algorithm(KNNAlgorithmName::CoverTree)
45 .with_k(3)
46 .with_distance(Distance::Euclidean)
47 .with_weight(KNNWeightFunction::Uniform),
48 )
49 .with_svr_settings(
50 SVRParameters::default()
51 .with_eps(0.1)
52 .with_tol(1e-3)
53 .with_c(1.0)
54 .with_kernel(Kernel::Linear),
55 )
56 .with_random_forest_regressor_settings(
57 RandomForestRegressorParameters::default()
58 .with_m(1)
59 .with_max_depth(5)
60 .with_min_samples_leaf(1)
61 .with_n_trees(10)
62 .with_min_samples_split(2),
63 )
64 .with_decision_tree_regressor_settings(
65 DecisionTreeRegressorParameters::default()
66 .with_min_samples_split(2)
67 .with_max_depth(15)
68 .with_min_samples_leaf(1),
69 );
70
71 settings.save("examples/maximal_regression_settings.yaml");
73
74 let mut model = SupervisedModel::new(smartcore::dataset::diabetes::load_dataset(), settings);
76
77 model.train();
79
80 println!("{}", model);
82
83 model.save("examples/maximal_regression_model.aml");
85}