/// <summary> ///Show how to get the Mean Squared Error ///</summary> //[TestMethod()] public void GetMeanSquaredErrorTest() { var svm = new Epsilon_SVR(training_prob, KernelHelper.RadialBasisFunctionKernel(gamma), C, epsilon); double cms = svm.GetMeanSquaredError(); Assert.IsTrue(cms > 0); }
private void buttonSVM_Click(object sender, EventArgs e) { List <double> values = new List <double>(); foreach (var column in checkedListBoxVariableRellenar.SelectedItems) { for (int i = 0; i < dt.Rows.Count; i++) { values.Add(double.Parse(dt.Rows[i][column.ToString()].ToString())); } var dataTraining = ProblemHelper.ReadAndScaleProblem(new List <List <double> >() { values }); var svm = new Epsilon_SVR(DataProblem, KernelHelper.RadialBasisFunctionKernel(Gamma), C, Elipson); double mse = svm.GetMeanSquaredError(); var prediction = svm.Predict(dataTraining.x[0]); } // 1. primero se debe armar una subtabla con los atributos que se van a utilizar. // que serian los que estan en el checkbox. // 2. elegir la columna sobre la que se quiere rellenar valores // 3. se quitan los registros que contengan datos faltantes de las variables predictoras, para este caso son los que tengan valor de -200 // 4. Aplicar el algoritmo de VSM // 5. Generar Vista con valores resultado // 6. Generar resumen de resultados: en tal fila, cambie tal por tal. }
/// <summary> ///Show how predict values for regression problems ///</summary> //[TestMethod()] public void PredictTest() { //Train the svm with the training datatset var svm = new Epsilon_SVR(training_prob, KernelHelper.RadialBasisFunctionKernel(gamma), C, epsilon); for (int i = 0; i < test_prob.l; i++) { var x = test_prob.x[i]; var expectedValue = test_prob.y[i]; var predictedValue = svm.Predict(x); Console.WriteLine( String.Format( "Predicted value = {0} || Expected value = {1} || Error = {2}", predictedValue, expectedValue, Math.Abs(predictedValue - expectedValue))); } }
/// <summary> ///Show how to get the sqsuared correlation coefficient using cross validation method ///Note : cros validation use the full dataset to increase the accuracy ///</summary> //[TestMethod()] public void GetCrossValidationSqsuaredCorrelationCoefficientTest() { var svm = new Epsilon_SVR(training_prob, KernelHelper.RadialBasisFunctionKernel(gamma), C, epsilon); double CVS = svm.GetCrossValidationSqsuaredCorrelationCoefficient(); }