csharpyml

Build status Build Status Windows https://circleci.com/gh/sdpython/csharpyml/tree/master.svg?style=svg https://badge.fury.io/py/csharpyml.svg GitHub Issues MIT License Requirements Status https://codecov.io/github/sdpython/csharpyml/coverage.svg?branch=master Notebook Coverage

Links: github, documentation README, blog

What is it?

csharpyml implements a way to interact with C# and ML.net from Python. The module relies on pythonnet, wraps ML.net and Scikit.ML (see also Scikit.ML Documentation).

Documentation

It can easily compile and wrap a C# function into Python:

<<<

from csharpyml.binaries import maml
print(maml('?')[0])

>>>

    Available commands:
      Chain: Chain Command
      CV: Cross Validation
      Evaluate: Evaluate Predictor
      GamVisualization: GAM Vizualization Command
        Aliases: gamviz
      GenerateSamplePredictionCode: Generate Sample Prediction Code
        Aliases: codegen
      Help: MAML Help Command
        Aliases: ?
      SaveData: Save Data
        Aliases: save
      SaveOnnx: Save ONNX
      SavePfa: Save PFA
      SavePredictorAs: Save Predictor As
        Aliases: SavePredictor, SaveAs, SaveModel
      Score: Score Predictor
      ShowData: Show Data
        Aliases: show
      ShowSchema: Show Schema
        Aliases: schema
      Sweep: Sweep
      Test: Test Predictor
      Train: Train Predictor
      TrainTest: Train Test
      Version: Version Command

The list of available trainers can be obtained with:

<<<

from csharpyml.binaries import maml
print(maml('? kind=trainer')[0])

>>>

    Available components for kind 'Trainer':
      AveragedPerceptron: Averaged Perceptron
        Aliases: avgper, ap
      BinaryClassificationGamTrainer: Generalized Additive Model for Binary Classification
        Aliases: gam
      BinarySGD: Hogwild SGD (binary)
        Aliases: sgd
      EnsembleRegression: Regression Ensemble (bagging, stacking, etc)
      FastForestClassification: Fast Forest Classification
        Aliases: FastForest, ff, ffc
      FastForestRegression: Fast Forest Regression
        Aliases: ffr
      FastTreeBinaryClassification: FastTree (Boosted Trees) Classification
        Aliases: FastTreeClassification, FastTree, ft, ftc, FastRankBinaryClassification, FastRankBinaryClassificationWrapper, FastRankClassification, fr, btc, frc, fastrank, fastrankwrapper
      FastTreeRanking: FastTree (Boosted Trees) Ranking
        Aliases: ftrank, FastRankRanking, FastRankRankingWrapper, rank, frrank, btrank
      FastTreeRegression: FastTree (Boosted Trees) Regression
        Aliases: ftr, FastRankRegression, FastRankRegressionWrapper, frr, btr
      FastTreeTweedieRegression: FastTree (Boosted Trees) Tweedie Regression
        Aliases: fttweedie
      FieldAwareFactorizationMachine: Field-aware Factorization Machine
        Aliases: ffm
      InternalOVA: MultiToBinary
        Aliases: iOVA
      InternalOVARanker: MultiToRanker
        Aliases: iOVArk
      KMeansPlusPlus: KMeans++ Clustering
        Aliases: KM, KMeans
      kNNbc: NearestNeighborsBC
        Aliases: kNN
      kNNmcl: NearestNeighborsMCC
        Aliases: kNNmc
      LightGBMBinary: LightGBM Binary Classifier
        Aliases: LightGBM
      LightGBMMulticlass: LightGBM Multi-class Classifier
        Aliases: LightGBMMC
      LightGBMRanking: LightGBM Ranking
        Aliases: LightGBMRank
      LightGBMRegression: LightGBM Regressor
        Aliases: LightGBMR
      LinearSVM: SVM (Pegasos-Linear)
        Aliases: svm
      LogisticRegression: Logistic Regression
        Aliases: lr, logisticregressionwrapper
      MatrixFactorization: Matrix Factorization
        Aliases: libmf, mf
      MultiClassLogisticRegression: Multi-class Logistic Regression
        Aliases: MulticlassLogisticRegressionPredictorNew, mlr, multilr
      MultiClassNaiveBayes: Multiclass Naive Bayes
        Aliases: MNB
      OLSLinearRegression: Ordinary Least Squares (Regression)
        Aliases: ols
      OnlineGradientDescent: Stochastic Gradient Descent (Regression)
        Aliases: ogd, sgdr, stochasticgradientdescentregression
      OptimizedOVA: Optimized One-vs-All
        Aliases: OOVA
      OVA: One-vs-All
      pcaAnomaly: PCA Anomaly Detector
        Aliases: pcaAnom
      PKPD: Pairwise coupling (PKPD)
      PoissonRegression: Poisson Regression
        Aliases: PoissonRegressionNew, Poisson, PR
      PrePost: PPTSP
      PriorPredictor: Prior Predictor
        Aliases: prior, constant
      RandomPredictor: Random Predictor
        Aliases: random
      RegressionGamTrainer: Generalized Additive Model for Regression
        Aliases: gamr
      SDCA: Fast Linear (SA-SDCA)
        Aliases: LinearClassifier, lc, sasdca
      SDCAMC: Fast Linear Multi-class Classification (SA-SDCA)
        Aliases: sasdcamc
      SDCAR: Fast Linear Regression (SA-SDCA)
        Aliases: sasdcar
      SymbolicSGD: Symbolic SGD (binary)
        Aliases: SymSGD
      WeightedEnsemble: Parallel Ensemble (bagging, stacking, etc)
        Aliases: pe, ParallelEnsemble
      WeightedEnsembleMulticlass: Multi-class Parallel Ensemble (bagging, stacking, etc)

This function also exists as a magic command %%maml.