NNStorm
Machine Learning algorithms written from scratch can take 100s of lines to make, using Sklearn and other frameworks like Keras and tensorflow you can create a machine learning algorithm that needs slightly more than 30 lines. Using this framework you can create a machine learning algorithm in one line and give in inputs. I was inspired by other frameworks like sklearn and keras. In the hackathon, I learned how to write many machine learning algorithms. The main challenge was maximizing efficiency.
To install the project:
git clone https://github.com/PranjalChaitanya/NNStormHackBCA.git
The current stable machine learning algorithms are
- Linear Regression
- Logistic Regression
- K-Nearest Neighbors
- Naive Bayes
- Decision Trees
For classification using neural networks
- 28*28 image classification
Installations
Make sure you have tensorflow, keras, pandas, sklearn, and numpy
In your virtual enviornment
pip install keras
pip install tensorflow
pip install sklearn
pip install pandas
pip install numpy
Demo
In order to see how the algorithms work there is a folder titled Demo, the BreastCancer folder contains algorithms found on the internet showing how the algorithm must be written without it, meanwhile, the file BreastCancerNNStorm.py shows how quickly it can be done with the new framework, the same applies for the housing data files.
Usage
Create a new python file in the MainFiles at the top of the file
import MainFiles.NNStorm as NNS
Single Linear Regression
print(NNS.NNStormAlgorithms.autoSingleReg(self, dataset, X, y, predictioArray))
print(NNS.NNStormAlgorithms.autoSingleLinReg(NNS, "../CSVAndSavedFile/housing.csv", "median_income", "median_house_value"))
Multiple Linear Regression
print(NNS.NNStormAlgorithms.autoMultipleReg(self, dataset, X, y))
print(NNS.NNStormAlgorithms.autoMultipleReg(NNS, "../CSVAndSavedFile/housing.csv", ["housing_median_age","total_rooms","total_bedrooms","population","households","median_income"], "median_house_value"))
K-Neighbors Neighbors
print(NNS.NNStormAlgorithms.autoKNN(self, dataset, X, y, predictedArray))
print(NNS.NNStormAlgorithms.autoKNN(NNS, "../CSVAndSavedFile/iris.csv", ["sepal_length", "sepal_width", "petal_length", "petal_width"], "species", [7,4,6,3]))
Logistic Regression
print(NNS.NNStormAlgorithms.autoLogisticRegression(NNS, dataset, X, y, predicted_array))
print(NNS.NNStormAlgorithms.autoLogisticRegression(NNS, "../CSVAndSavedFile/iris.csv", ["sepal_length", "sepal_width", "petal_length", "petal_width"], "species", [7, 4, 6, 3]))
Naive Bayes
print(NNS.NNStormAlgorithms.DecisionTree(NNS, dataset, X, y, predicted_array))
print(NNS.NNStormAlgorithms.DecisionTree(NNS, "../CSVAndSavedFile/iris.csv", ["sepal_length", "sepal_width", "petal_length", "petal_width"], "species", [7, 4, 6, 3]))
Neural Networks
28 * 28 image classification, can be used for MNIST and other images datasets
print(NNS.NNStormClassification.autoClassification28By28(NNS, x_train, y_train, x_test, y_test, 10))