A small machine learning package
Project description
# nista_learn
This is a Python ML librabry like scikit-learn
You can create your ML model or use some ML algorithms on your project
## Example: Logistic Regression
Read csv file and slip data into training and test data
````
import pandas as pd
df = pd.read_csv('Data_for_UCI_named.csv', header=0)
df['stabf'] = df['stabf'].map({'unstable': 0, 'stable': 1})
Y = df['stabf'].values
# sometimes it's needed to reshape data
X = df.drop(['stabf'], axis=1).values
X_train = X[:9000]
Y_train = Y[:9000]
X_test = X[9000:]
Y_test = Y[9000:]
````
Let's use our library
````
# call the LogisticRegression class
from nista_learn.regressions import LinearRegression, LogisticRegression
log_reg = LogisticRegression()
# fitting data
log_reg.fit(X_train, Y_train, iterations=200000, learning_rate=0.25, show=True)
# predict a small dataset
y_pred = log_reg.predict(X_test[20:28])
print('--- small value ---')
print(Y_test[20:28])
print('--- predicted data ---')
print(y_pred)
# plotting the cost function
log_reg.plot_cost()
```
This is a Python ML librabry like scikit-learn
You can create your ML model or use some ML algorithms on your project
## Example: Logistic Regression
Read csv file and slip data into training and test data
````
import pandas as pd
df = pd.read_csv('Data_for_UCI_named.csv', header=0)
df['stabf'] = df['stabf'].map({'unstable': 0, 'stable': 1})
Y = df['stabf'].values
# sometimes it's needed to reshape data
X = df.drop(['stabf'], axis=1).values
X_train = X[:9000]
Y_train = Y[:9000]
X_test = X[9000:]
Y_test = Y[9000:]
````
Let's use our library
````
# call the LogisticRegression class
from nista_learn.regressions import LinearRegression, LogisticRegression
log_reg = LogisticRegression()
# fitting data
log_reg.fit(X_train, Y_train, iterations=200000, learning_rate=0.25, show=True)
# predict a small dataset
y_pred = log_reg.predict(X_test[20:28])
print('--- small value ---')
print(Y_test[20:28])
print('--- predicted data ---')
print(y_pred)
# plotting the cost function
log_reg.plot_cost()
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nista_learn-0.0.2.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for nista_learn-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41463316445d4dfbd55d94824c1c66e1dcd1628317b680837a1cfdb11d0cb069 |
|
MD5 | 48322d91eff8e1c72a49c7e0564efd40 |
|
BLAKE2b-256 | 1f605cd8390453952eb3e14118fbd2e8c96683623b5125386c863e14a0b5a37d |