Skip to content

Commit

Permalink
working on demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Peiyuan Liao committed Aug 27, 2021
1 parent f75d273 commit 266d351
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 161 deletions.
376 changes: 220 additions & 156 deletions eth/demo.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion eth/keys/out_private.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"7001944839470927745373394821470350369266097788845460368251493193132763972406"
"21127377611760855151397025938040417124468957529580509010001250098001910171200"
4 changes: 2 additions & 2 deletions eth/keys/out_public.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
"3696244767974077653455679795135848733601425960305578671455690036664496274007",
"10438300322976132768889289517836059848150371544640472911377544330755492363717"
"19517200380561602233013947304080897707587995089006775240619814703482168364893",
"10758991262778566768807205545860719510109920355369254969648901060785189870847"
]
Binary file modified eth/model/W.npy
Binary file not shown.
Binary file modified eth/model/b.npy
Binary file not shown.
Binary file modified eth/model_shuffled/W.npy
Binary file not shown.
Binary file modified eth/model_shuffled/b.npy
Binary file not shown.
3 changes: 2 additions & 1 deletion eth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"scripts": {
"compile": "npx hardhat compile",
"deploy-localhost": "npx hardhat run --network localhost scripts/deploy.js"
"deploy-localhost": "npx hardhat run --network localhost scripts/deploy.js",
"prepare-demo": "npx hardhat compile && npx hardhat run --network localhost scripts/deploy.js && npx hardhat add_bounty"
}
}
38 changes: 38 additions & 0 deletions eth/prepare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@


import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_iris # Load Iris Data

iris = load_iris() # Creating pd DataFrames

iris_df = pd.DataFrame(data= iris.data, columns= iris.feature_names)
target_df = pd.DataFrame(data= iris.target, columns= ['species'])

def converter(specie):
if specie == 0:
return 'setosa'
elif specie == 1:
return 'versicolor'
else:
return 'virginica'

target_df['species'] = target_df['species'].apply(converter)# Concatenate the DataFrames
iris_df = pd.concat([iris_df, target_df], axis= 1)

# Converting Objects to Numerical dtype
iris_df.drop('species', axis= 1, inplace= True)
target_df = pd.DataFrame(columns= ['species'], data= iris.target)
iris_df = pd.concat([iris_df, target_df], axis= 1)# Variables
X= iris_df.drop(labels= 'sepal length (cm)', axis= 1)
y= iris_df['sepal length (cm)']

# Splitting the Dataset
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size= 0.13, random_state= 101)

X = X_test.values[:]
Yt_expected = y_test.values[:].reshape(-1, 1)

np.save('dataset/X.npy',X)
np.save('dataset/Y.npy',Yt_expected)
2 changes: 1 addition & 1 deletion eth/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"m": 20,
"p": 4,
"n": 1,
"mse_target": 0.11232375
"mse_target": 0.07864
}

0 comments on commit 266d351

Please sign in to comment.