Skip to content

ariaghora/pasml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PasML

A collection of machine learning algorithms for object pascal.

Implemented algorithms

Category Type Model Notes
Unsupervised Clustering K-Means Only random centroid initialization. Gladly accept your contribution.
Supervised Classification Decision Tree C4.5 implementation. Continuous data handling only for now.
Supervised Classification Naive Bayes Gaussian naive bayes
Supervised Regression MLP Regressor Multi-layer perceptron regressor. Requires noe.

Numerik compatibility

Dataset := ReadCSV('datasets/iris.csv');
X := Dataset[[_ALL_, [0, 1, 2, 3]]];
y := Dataset[[_ALL_, 4]];

Clustering example

kmeans := TKMeans.Create(3);
kmeans.Fit(X);
WriteLn('Clustering result:');
PrintMultiArray(kmeans.Predict(X));

Classification example

nb := TNaiveBayesClassifier.Create;
nb.Fit(X, y);
pred := nb.Predict(X);

WriteLn('Accuracy:');
WriteLn(Mean(pred = Ravel(y)).Item);

Integration with gnuplot

PasML has gnuplot integration support. Please ensure that you have installed gnuplot and add the executable path to the environment variable. Currently only scatter and line plots are supported.

fig := TFigure.Create('Iris Flower Features', 'Petal length', 'Petal width');
fig.AddScatterPlot(X[[_ALL_, [2, 3]]].SliceBool([y = 0]), 'Iris Setosa');
fig.AddScatterPlot(X[[_ALL_, [2, 3]]].SliceBool([y = 1]), 'Iris Virginica');
fig.AddScatterPlot(X[[_ALL_, [2, 3]]].SliceBool([y = 2]), 'Iris Versicolor');
fig.LegendPosition := lpLeftTop;
fig.Show;

fig.Free;                                                                    

Note

  • PasML requires numerik, so you should install it first. Refer to numerik installation guide.
  • If you want to work with neural network, please check noe framework that was designed specifically for this task.

About

A collection of machine learning algorithms for object pascal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages