Projekt

Obecné

Profil

Stáhnout (1.67 KB) Statistiky
| Větev: | Tag: | Revize:
1
//
2
// Author: Roman Kalivoda
3
//
4

    
5
using System;
6
using System.Collections.Generic;
7
using System.Linq;
8
using System.Text;
9
using System.Threading.Tasks;
10
using Microsoft.ML;
11
using Microsoft.ML.Data;
12

    
13

    
14
namespace ServerApp.Predictor
15
{
16
    /// <summary>
17
    /// A predictor interface.
18
    /// </summary>
19
    public interface IPredictor
20
    {
21
        /// <summary>
22
        /// Trains the predictor with the given training data input.
23
        /// </summary>
24
        /// <param name="trainInput">A collection of <c>ModelInput</c> instances. The objects contain both feature vector inputs and corresponding labels.</param>
25
        void Fit(IEnumerable<ModelInput> trainInput);
26

    
27
        /// <summary>
28
        /// Predicts class to the given feature vector.
29
        /// </summary>
30
        /// <param name="input">A feature vector in <c>ModelInput</c> instance.</param>
31
        /// <returns>A predicted label.</returns>
32
        string Predict(ModelInput input);
33

    
34
        /// <summary>
35
        /// Evaluates the model on <paramref name="modelInputs"/> and prints metrics to console.
36
        /// </summary>
37
        /// <param name="modelInputs">Input data used to evaluate the predictor.</param>
38
        void Evaluate(IEnumerable<ModelInput> modelInputs);
39

    
40
        /// <summary>
41
        /// Saves the trained model under given filename.
42
        /// </summary>
43
        /// <param name="filename">Path of the file.</param>
44
        public void Save(string filename);
45

    
46
        /// <summary>
47
        /// Loads an IPredictor model from file
48
        /// </summary>
49
        /// <param name="filename">Path to the model file.</param>
50
        /// <returns>A prediction model.</returns>
51
        public void Load(string filename);
52
    }
53
}
(5-5/11)