EDUX is a user-friendly library for solving problems with a machine learning approach.
Goal
The main goal of this project is to create a user-friendly library for solving problems using a machine learning approach. The library is designed to be easy to use, enabling the solution of problems with just a few lines of code.
Installation
To install, include the library as a dependency in your Java project file.
Gradle
implementation 'io.github.samyssmile:edux:1.0.4'
Maven
<dependency>
<groupId>io.github.samyssmile</groupId>
<artifactId>edux</artifactId>
<version>1.0.4</version>
</dependency>
Usage - Neural Network
- You need to implement a IDataProvider Interface to provide the data for the network. Example for the IRIS-Dataset.
public class IrisProvider implements IDataProvider<Iris>
- Create a Neural Network Configuration.
var neuralNetworkConfiguration = new Configuration(
inputSize,
hiddenLayersSize,
outputSize,
learningRate,
epochs,
ActivationFunction.LEAKY_RELU, // Activation function of the hidden layers
ActivationFunction.SOFTMAX, // Activation function of the output layer
LossFunction.CATEGORICAL_CROSS_ENTROPY);// Loss function of the network
- Create a Neural Network with the configuration and data from provider. Finaly train the network.
var neuralNetwork = new NeuralNetwork(features, labels, testFeatures, testLabels, neuralNetworkConfiguration);
neuralNetwork.train();
You can predict the output with the predict method.
var prediction = neuralNetwork.predict(yourInputYouWantToPredict);
K Nearest Neighbors
Its also possible to use the K Nearest Neighbors algorithm.
KnnClassifier knnClassifier = new KnnClassifier(1, labeledPoints);
a full working example can be found in
package knn.example.de.nexent.edux.KnnExample.java
- Implement IDataProvider Interface to get your data.
- Transform your data to LabeledPoints.
- Create a KnnClassifier with the number of neighbors and the labeled points.
You can evaluate the accuracy of the classifier with the evaluate method.
knnClassifier.evaluate(testLabeledPoints);
output
[main] INFO knn.ml.de.nexent.edux.KnnClassifier - Accuracy: 98.33333333333333%
To classify a single record use the classify method.
knnClassifier.classify(...);
Decision Tree
A full working example can be found in
package decisiontree.example.de.nexent.edux.DecisionTreeExample.java
Example Output for IRIS Datenset
de.edux.ml.decisiontree.DecisionTree - Accuracy: 95,0000%
Feature Importance: [0.4444444444444444, 0.0, 0.4291223175466741, 0.42559077319203725]
Features
The library currently supports:
- Multilayer Perceptron
- K Nearest Neighbors
- Descision Tree
- Support Vector Machine (progress)
- Random Forest (progress)
Contributions
Contributions are warmly welcomed! If you find a bug, please create an issue with a detailed description of the problem. If you wish to suggest an improvement or fix a bug, please make a pull request.
