Created
February 15, 2019 16:43
-
-
Save Niranjankumar-c/e8b40a5d5d6d7f93d8ea1ed8e0471ee0 to your computer and use it in GitHub Desktop.
Implementation of MP Neuron using Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sklearn.datasets | |
import numpy as np | |
import pandas as pd | |
breast_cancer = sklearn.datasets.load_breast_cancer() | |
X = breast_cancer.data | |
Y = breast_cancer.target | |
#Converting the data to Pandas dataframe | |
data = pd.DataFrame(breast_cancer.data, columns=breast_cancer.feature_names) | |
data['class'] = breast_cancer.target | |
data.head() | |
from sklearn.model_selection import train_test_split | |
X = data.drop('class', axis=1) | |
Y = data['class'] | |
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.1, stratify = Y) | |
#converting the input features to a binary format | |
X_binarised_train = X_train.apply(pd.cut, bins=2, labels=[1,0]) | |
X_binarised_test = X_test.apply(pd.cut, bins=2, labels=[1,0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment