Wednesday, March 27, 2024

Apr '24 Regional Tech Events

Trainers in ML.NET

Machine learning tasks like regression and classification contain various algorithm implementations. 

Some tasks may utilize the same algorithm, such as the SDCA algorithm in both Binary Classification and Regression tasks

 

In some cases, the problem you are trying to solve and the way your data is structured does not fit well into the current algorithm.

If so, consider using a different algorithm for your task to see if it learns better from your data.

 

A trainer identifies a single algorithm used for a single task (i.e. Trainer = Algorithm + Task).

Listed below is a summary of trainers available in ML.NET. For more info, see guidance on which algorithm to choose.

 

Trainer

Algorithm

Task

ONNX Exportable

SdcaLogisticRegressionBinaryTrainer

SDCA

Binary classification

Yes

SdcaNonCalibratedBinaryTrainer

SDCA

Binary classification

Yes

SdcaMaximumEntropyMulticlassTrainer

SDCA

Multiclass classification

Yes

SdcaNonCalibratedMulticlassTrainer

SDCA

Multiclass classification

Yes

SdcaRegressionTrainer

SDCA

Regression

Yes

AveragedPerceptronTrainer

Averaged Perceptron

Binary classification

Yes

LbfgsLogisticRegressionBinaryTrainer

L-BFGS

Binary classification

Yes

LbfgsMaximumEntropyMulticlassTrainer

L-BFGS

Multiclass classification

Yes

LbfgsPoissonRegressionTrainer

L-BFGS

Regression

Yes

SymbolicSgdLogisticRegressionBinaryTrainer

Symbolic stochastic gradient descent

Binary classification

Yes

OnlineGradientDescentTrainer

Online gradient descent

Regression

Yes

LightGbmBinaryTrainer

Light gradient boosted machine

Binary classification

Yes

LightGbmMulticlassTrainer

Light gradient boosted machine

Multiclass classification

Yes

LightGbmRegressionTrainer

Light gradient boosted machine

Regression

Yes

LightGbmRankingTrainer

Light gradient boosted machine

Ranking

No

FastTreeBinaryTrainer

Fast Tree

Binary classification

Yes

FastTreeRegressionTrainer

Fast Tree

Regression

Yes

FastTreeTweedieTrainer

Fast Tree

Regression

Yes

FastTreeRankingTrainer

Fast Tree

Ranking

No

FastForestBinaryTrainer

Fast Forest

Binary classification

Yes

FastForestRegressionTrainer

Fast Forest

Regression

Yes

GamBinaryTrainer

Generalized additive model

Binary classification

No

GamRegressionTrainer

Generalized Additive Model

Regression

No

MatrixFactorizationTrainer

Matrix Factorization

Recommendation

No

FieldAwareFactorizationMachineTrainer

Field Aware Factorization Machine

Binary classification

No

OneVersusAllTrainer

One Versus All

Multiclass classification

Yes

PairwiseCouplingTrainer

Pairwise Coupling

Multiclass classification

No

KMeansTrainer

KMeans

Clustering

Yes

RandomizedPcaTrainer

Randomized Pca

Anomaly detection

No

NaiveBayesMulticlassTrainer

Naive Bayes Multiclass

Multiclass classification

Yes

PriorTrainer

Prior

Binary classification

Yes

LinearSvmTrainer

Linear Svm

Binary classification

Yes

LdSvmTrainer

Ld Svm

Binary classification

Yes

OlsTrainer

Ols

Regression

Yes

 

 

Tuesday, March 12, 2024

What is Auto-GPT?

Auto-GPT is an experimental project developed by Significant Gravitas.  It’s an open-source Python application powered by GPT-4.

 

Unlike ChatGPT, Auto-GPT does not rely on human prompts to operate. It can self-prompt and tackle subsets of a problem without human intervention.  It works by pairing GPT with AI agents that can make decisions and take actions based on a set of rules and predefined goals.

Auto-GPT is important and relevant because it showcases the potential of language models like GPT-4 to autonomously complete different types of tasks. It has the ability to write and execute its own code using GPT-4, allowing it to debug, develop, and self-improve recursively. One of the advantages of Auto-GPT is its ability to continuously self-improve. It can debug, develop, and enhance its own capabilities recursively.

 

Accessing Auto-GPT requires specific installed software and familiarity with Python, and an API key from OpenAI.  It runs locally on a Mac, PC, or Docker image.

 

For a complete tutorial on how to use AutoGPT, visit https://youtu.be/v-5AWQlTFw8

 

For more info, see What is Auto-GPT and What Is the Difference Between ChatGPT vs Auto-GPT?

 

Thursday, March 7, 2024

ML.NET Task Metrics

ML.Net has the capability of utilizing 7 different Machine Learning Tasks via the MLContext object:

  1. Binary Classification
  2. Multi-class/text Classification
  3. Regression and Recommendation
  4. Clustering
  5. Ranking
  6. Anomaly Detection
  7. sentence similarity

 

Each task offers various performance metrics for evaluating the model after training is completed

These metrics are properties accessible via the Evaluate() method within each task object (i.e. MLContext.MLTask.Evaluate()

 

Sample Code Snippet

    static void Main(string[] args)

    {

        MLContext mlContext = new MLContext();

 

        // 1a. Create training data

        HouseData[] houseData = {

               new HouseData() { Size = 1.1F, Price = 1.2F },

               new HouseData() { Size = 1.9F, Price = 2.3F },

               new HouseData() { Size = 2.8F, Price = 3.0F },

               new HouseData() { Size = 3.4F, Price = 3.7F } };

 

        // 1b. Import training data

        IDataView trainingData = mlContext.Data.LoadFromEnumerable(houseData);

 

        // 2. Specify data preparation and model training pipeline

        var pipeline = mlContext.Transforms.Concatenate("Features", new[] { "Size" })

            .Append(mlContext.Regression.Trainers.Sdca(labelColumnName: "Price", maximumNumberOfIterations: 100));

 

        // 3. Train model

        var model = pipeline.Fit(trainingData);

 

        //***** Model Evaluation

        HouseData[] testHouseData =

        {

            new HouseData() { Size = 1.1F, Price = 0.98F },

            new HouseData() { Size = 1.9F, Price = 2.1F },

            new HouseData() { Size = 2.8F, Price = 2.9F },

            new HouseData() { Size = 3.4F, Price = 3.6F }

        };

 

        var testHouseDataView = mlContext.Data.LoadFromEnumerable(testHouseData);

        var testPriceDataView = model.Transform(testHouseDataView);

 

        var metrics = mlContext.Regression.Evaluate(testPriceDataView, labelColumnName: "Price");

        double rs = metrics.RSquared;

        double rmse = metrics.RootMeanSquaredError;

    }

 

Metrics Summary

Listed below is a summary of 6 various ML.NET Tasks and their metrics:

 

BinaryClassification

MulticlassClassification

Regression

Accuracy

Micro Accuracy

R-Squared

AUC

Macro Accuracy

MAE (Mean Absolute Error)

AreaUnderPrecisionRecallCurve

Log-Loss

MSE (Mean Squared Error)

F1-score

Log Loss Reduction

RMSE (Root Mean Square Error)

 

 

Clustering

Ranking

AnomalyDetection

Avg Distance

DCG
(Discounted Cumulative Gains)

Area Under ROC Curve

Davies Boulding Index

Normalized DCG
(Discounted Cumulative Gains)

Detection Rate At False Positive Count

NMI
(Normalized Mutual Information)

 

 

 

 

Reference: https://learn.microsoft.com/en-us/dotnet/machine-learning/resources/metrics