Machine Learning

From ABCs to PhDs, the Wolfram Language is your tool for machine learning.


Built-in Classifiers

You don't have to be an expert to use machine learning in your project: the Wolfram Language has pre-trained, ready-to-use classifier functions so you can easily perform useful and interesting tasks.

The Wolfram Language includes a wide range of pre-trained classifiers that can be applied to text, images and more.

See a full list of pre-trained classifiers

Building Custom Classifiers

Using the function Classify can save you a lot of time. Classify can learn a classification task from a small set of examples and then automatically figure out the best way to classify your data.

For example, let's say you needed to label 1,000 vacation photos with whether they had people in them or not—a time-consuming task if done by hand. If you labeled just 20 photos, Classify could learn to differentiate between photos with people and without automatically and do the other photos in under a second:
Let's test our new ClassifierFunction we created against new images it hasn't seen before:

Neural Networks

Pre-Built Neural Networks

For many common tasks, you'll find that the Wolfram Neural Net Repository contains exactly the neural network you are trying to implement, free and ready for immediate use in your project. As a neat visual example, here the CycleGAN network is called to restyle an image into a Van Gogh–like style:

NetModel["CycleGAN Photo-to-Van Gogh Translation"]
resizedNet=NetReplacePart[NetModel["CycleGAN Photo-to-Van Gogh Translation"],{"Input"->netEnc,"Output"->NetDecoder[{"Image"}]}]

Click here for a complete listing of the 100+ neural networks available from the Wolfram Neural Net Repository

Custom Neural Networks

With high-level constructs like NetTrain and NetChain, the Wolfram Language has great tools to quickly build even prototype or sophisticated neural networks.

Construct a net that explicitly computes a loss:
Initialize the net and evaluate it on an input:

In this example, NetTrain is used to train a neural net. A progress window allows you to see the training result in real time.

Manually construct a net and initialize it with random parameters:
net=NetInitialize@NetChain[{ LinearLayer[10],BatchNormalizationLayer[],ElementwiseLayer[Ramp], LinearLayer[10],BatchNormalizationLayer[],ElementwiseLayer[Ramp], LinearLayer[1]}, "Input"->"Scalar","Output"->"Scalar"]
Evaluate it on a set of values:
net[{1, 2, 3}]
x = Range[-5, 5, .01]; f := x |-> .3 x^2 + 2 x - 4 y = f[x];
Train the net for a few rounds checking in real time how it is fitting the model:
trainedNet = NetTrain[net, <|"Input" -> x, "Output" -> y|>, MaxTrainingRounds -> 300, TrainingProgressReporting -> {Function[ Plot[{f[x], #Net[x]}, {x, -5, 5}, PlotLegends -> {HoldForm[f[x]], HoldForm[net[x]]}]], "Interval" -> 1}];
The net result is now close to the symbolic computation:
trainedNet[{1, 2, 3}]
f[{1, 2, 3}]

Get Started

Learning Resources

Learning Paths

Try it now, learn later

Want to just try it out? Get a feel for what the Wolfram Language is like while trying out real code samples focused on machine learning.

Try these instantly! Access with a free Wolfram Cloud account
Get certified for free in the Wolfram Language

We've made it easy to learn the Wolfram Language your way. Try our free interactive course and earn a certification.

Start the interactive online course now! About 7 hours for completion
Try these instantly! Access with a free Wolfram Cloud account
Start the interactive online course now! About 7 hours for completion

Go Further with Machine Learning

Want to keep exploring machine learning?

If you want to see more of what Wolfram offers for machine learning, head to the Wolfram Machine Learning page. You'll find:

  • A complete overview
  • Documentation and specialized functions
  • Pre-trained neural networks
  • Downloadable examples
  • Online classes and additional resources
Learn more

Recommended Product