CreateModel() public method

Create a model.
public CreateModel ( DataSet dataset, string name = null, string inputFields = null, string objectiveField = null, Model arguments = null ) : Task
dataset DataSet A DataSet instance
name string The name you want to give to the new model.
inputFields string Specifies the ids of the fields that you want to use as predictors to create the model.
objectiveField string Specifies the id of the field that you want to predict.
arguments Model
return Task
Example #1
0
        /// <summary>
        /// Simple sample that runs through all steps to explicitly create a
        /// local prediction from a csv file with the classic iris data.
        /// </summary>
        static async Task MainAsync()
        {
            // New BigML client with username and API key
            Console.Write("user: "******"key: ");
            var ApiKey = Console.ReadLine();

            var client = new Client(User, ApiKey);

            // New source from in-memory stream, with separate header. That's the header
            var source = await client.CreateSource(iris, "Iris.csv", "sepal length, sepal width, petal length, petal width, species");
            // No push, so we need to busy wait for the source to be processed.
            while ((source = await client.Get(source)).StatusMessage.NotSuccessOrFail())
            {
                await Task.Delay(10);
            }
            Console.WriteLine(source.StatusMessage.ToString());

            // Default dataset from source
            var dataset = await client.CreateDataset(source);
            // No push, so we need to busy wait for the dataset to be processed.
            while ((dataset = await client.Get(dataset)).StatusMessage.NotSuccessOrFail())
            {
                await Task.Delay(10);
            }
            Console.WriteLine(dataset.StatusMessage.ToString());

            // Default model from dataset
            var model = await client.CreateModel(dataset);
            // No push, so we need to busy wait for the source to be processed.
            while ((model = await client.Get(model)).StatusMessage.NotSuccessOrFail())
            {
                await Task.Delay(10);
            }
            Console.WriteLine(model.StatusMessage.ToString());

            Console.WriteLine("Creating local model");
            Dictionary<string, dynamic> inputData = new Dictionary<string, dynamic>();
            inputData.Add("000002", 3);
            inputData.Add("000003", 1.5);

            var localModel = model.ModelStructure();
            var nodeResult = localModel.predict(inputData);

            Console.WriteLine("Predict:\n" + nodeResult);
        }