Skip to content

Latest commit

 

History

History
87 lines (69 loc) · 3.05 KB

File metadata and controls

87 lines (69 loc) · 3.05 KB

GitHub license Java GitHub issue comments Build Status

Machine Learning

This is used for beginner to start learning machine-learning technology. It provides the both of basic and advance libraries.

Libraries

  • Linear Regression: Basically, It will be used for finding mathematical model to predict value in the future that base on previouse values. This requires dataset which is CSV format.
  • Logistic Regression: It will be used for binary classificaion.
  • Neuron Network: Coming soon
  • Deep Q Learning: Coming soon

Cost fucntion

Optimization

  • Gradient descent

Example

  • Linear Regression
/* Prepare parameter */
double learningRate = 0.0001;
int numOfStep = 10000;

/* Read dataset from inputs.csv file */
LinkedList<Dataset> datasets = Dataset.fromFile("src\\com\\github\\pepsi7959\\SupervisedLearning\\inputs.csv");

/* Read expected value from ExpectedValue.csv */
LinkedList<Double> ev = Dataset
    .expectedValueFromFile("src\\com\\github\\pepsi7959\\SupervisedLearning\\ExpectedValue.csv");

/* Initialize coefficient (weight) and random value from 0 to 5 */
Matrix weight = new Matrix(datasets.getFirst().getCol(), 1);
weight.random(0, 5);

/* Create Linear Regression object */
LinearRegression LR = new LinearRegression(datasets, ev, learningRate, numOfStep, weight);

/* Train model until it reach number of step */
LR.train();

/*
 * Test model by using the inputs, but we recommend you should have dataset for
 * testing the model particularly
 */
LR.test(datasets, ev);
  • Logistic Regression
/* Prepare parameter */
double learningRate = 0.001;
int numOfStep = 1000000;

/* Read dataset from inputs.csv file */
LinkedList<Dataset> datasets = Dataset
    .fromFile("src\\com\\github\\pepsi7959\\UnsupervisedLearning\\inputs.csv");

/* Read expected value from ExpectedValue.csv */
LinkedList<Double> ev = Dataset
    .expectedValueFromFile("src\\com\\github\\pepsi7959\\UnsupervisedLearning\\ExpectedValue.csv");

/* Initialize coefficient (weight) and random value from 0 to 5 */
Matrix weight = new Matrix(datasets.getFirst().getCol(), 1);
weight.random(0, 5);

/* Create Logistic Regression object */
LogisticRegression LR = new LogisticRegression(datasets, ev, learningRate, numOfStep, weight);

/* Train model until it reach number of step */
LR.train();

/*
 * Test model by using the inputs, but we recommend you should have dataset for
 * testing the model particularly
 */
LR.Test(datasets, ev);
  • Neuron Network Coming soon