maximal_classification/
maximal_classification.rs1use automl::settings::*;
2use automl::*;
3
4fn main() {
5 let settings = Settings::default_classification()
7 .with_number_of_folds(3)
8 .shuffle_data(true)
9 .verbose(true)
10 .with_final_model(FinalModel::Blending {
11 algorithm: Algorithm::CategoricalNaiveBayes,
12 meta_training_fraction: 0.15,
13 meta_testing_fraction: 0.15,
14 })
15 .skip(Algorithm::RandomForestClassifier)
16 .sorted_by(Metric::Accuracy)
17 .with_preprocessing(PreProcessing::ReplaceWithPCA {
18 number_of_components: 5,
19 })
20 .with_random_forest_classifier_settings(
21 RandomForestClassifierParameters::default()
22 .with_m(100)
23 .with_max_depth(5)
24 .with_min_samples_leaf(20)
25 .with_n_trees(100)
26 .with_min_samples_split(20),
27 )
28 .with_logistic_settings(
29 LogisticRegressionParameters::default()
30 .with_alpha(1.0)
31 .with_solver(LogisticRegressionSolverName::LBFGS),
32 )
33 .with_svc_settings(
34 SVCParameters::default()
35 .with_epoch(10)
36 .with_tol(1e-10)
37 .with_c(1.0)
38 .with_kernel(Kernel::Linear),
39 )
40 .with_decision_tree_classifier_settings(
41 DecisionTreeClassifierParameters::default()
42 .with_min_samples_split(20)
43 .with_max_depth(5)
44 .with_min_samples_leaf(20),
45 )
46 .with_knn_classifier_settings(
47 KNNClassifierParameters::default()
48 .with_algorithm(KNNAlgorithmName::CoverTree)
49 .with_k(3)
50 .with_distance(Distance::Euclidean)
51 .with_weight(KNNWeightFunction::Uniform),
52 )
53 .with_gaussian_nb_settings(GaussianNBParameters::default().with_priors(vec![1.0, 1.0]))
54 .with_categorical_nb_settings(CategoricalNBParameters::default().with_alpha(1.0));
55
56 settings.save("examples/maximal_classification_settings.yaml");
58
59 let mut model =
61 SupervisedModel::new(smartcore::dataset::breast_cancer::load_dataset(), settings);
62
63 model.train();
65
66 println!("{}", model);
68
69 model.save("examples/maximal_classification_model.aml");
71}