Skip to content

cschen1205/cs-ensembles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cs-ensembles

Ensembles method implemented in C#

Install

Install-Package cs-ensembles

Usage

The sample codes below show how to use the AdaBoosting classifier:

IEnumerable<DDataRecord<string>> training_sample = LoadTrainingSamples();
IEnumerable<DDataRecord<string>> testing_sample = LoadTestingSamples();

AdaBoost<DDataRecord, string> classifier = new AdaBoost<DDataRecord, string>();
classifier.CreateAndTrainWeakClassifiers(training_sample, (t)=>
{
 //create and return a weak classifier such as a decision tree or perceptron
});
classifier.Train(training_sample);

foreach(DDataRecord rec in testing_sample)
{
   string predicted_label = classifier.Predict(rec);
}

The sample codes below show how to use the TreeBagging classifier:

IEnumerable<DDataRecord<string>> training_sample = LoadTrainingSamples();
IEnumerable<DDataRecord<string>> testing_sample = LoadTestingSamples();

TreeBagging<DDataRecord, string> classifier = new TreeBagging<DDataRecord, string>(
(t)=>
{
  //create and return a classifier such as a decision tree or perceptron
}, 900, 2.0 / 3);
classifier.Train(training_sample);

foreach(DDataRecord rec in testing_sample)
{
    string predicted_label = classifier.Predict(rec);
} 

Releases

No releases published

Packages

No packages published

Languages