Skip to content
Karl Li edited this page Jan 8, 2025 · 15 revisions

Commercial License

OEMs (Original Equipment Manufacturers), ISVs (Independent Software Vendors), VARs (Value Added Resellers) and other distributors that combine and distribute commercially licensed software with SMILE must enter into a commercial license agreement with SMILE.AI, LLC.

The commercial SMILE license gives you the full rights to create and distribute software on your own terms without any open source license obligations. With the commercial license you also have access to the official SMILE Support and close strategic relationship with SMILE.AI, LLC to make sure your development goals are met. To acquire a commercial license, please contact smile.sales@outlook.com.

Open Source License

The SMILE open source licensing is ideal for use cases such as Free Open Source Software ("FOSS") applications under the GPL that want to combine and distribute those FOSS applications with SMILE software, student/academic purposes, hobby projects, internal research projects without external distribution, or other projects where all GPL obligations can be met.

How should I cite Smile?

Please cite Smile in your publications if it helps your research. Here is an example BibTeX entry:

    @misc{Li2014Smile,
      title={Smile},
      author={Haifeng Li},
      year={2014},
      howpublished={\url{https://haifengl.github.io}},
    }

Headless Plot

In case that your environment does not have a display, or you need to generate and save a lot of plots without showing them on the screen, you may run Smile in headless model.

    bin/jshell.sh -R-Djava.awt.headless=true

The following example shows how to save a plot in the headless mode.

    import java.awt.Color;
    import smile.io.*;
    import smile.plot.swing.*;
    import org.apache.commons.csv.CSVFormat;

    var toy = Read.csv("data/classification/toy200.txt", CSVFormat.DEFAULT.withDelimiter('\t'));
    var canvas = ScatterPlot.of(toy, "V2", "V3", "V1", '.').canvas();
    var image = canvas.toBufferedImage(400, 400);
    javax.imageio.ImageIO.write(image, "png", new java.io.File("headless.png")); 

How can I set the random number generator seed for random forest?

This is a common question for stochastic algorithms like random forest. In general, this is discouraged because people often choose bad seed due to the lack of sufficient knowledge of random number generation. However, one may want the repeatable result for testing purpose. In this case, call smile.math.MathEx.setSeed() before training the model.

Note that we don't provide a method to set the seed for a particular algorithm. Many algorithms are multithreaded and each thread has their own random number generator. We choose this design because each random number generator maintains an internal state so that it is not multithread safe. If multithreads share a random number generator, we have to use locks, which significantly reduce the performance.

A method setSeed() in the algorithm is also troublesome. For algorithms like random forest, it is not right to initialize every thread with the same seed. Otherwise, same decision trees will be created, and we lose the randomness of "random" forest. It is also complicated to pass a sequence of random numbers because it is not clear how many random number generators are needed for many algorithms. Even worse, it breaks the encapsulation as the caller has to know the details of algorithms.