Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uncomment plot_pca #425

Merged
merged 2 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ai/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def initialize_recommenders(self, rec_class):
recArgs = self.DEFAULT_REC_ARGS[pred_type]
recArgs['ml_p'] = ml_p

recArgs['serialized_rec_directory'] = 'data/recommenders/pennaiweb'
recArgs['serialized_rec_directory'] = '/appsrc/data/recommenders/pennaiweb'
recArgs['load_serialized_rec'] = "if_exists"

if kb is not None:
Expand Down
37 changes: 37 additions & 0 deletions ai/recommender/surprise_recommenders.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,49 @@ def _reconstruct_training_data(self, results_data, results_mf=None,
"""
# update trained dataset models and hash table
super().update(results_data, results_mf, source)

print('results_data', results_data)
print('results_mf', results_mf)
print('source', source)

# updates self.results_df and self.trainset
self._update_training_data(results_data, shuffle=True)
# check whether the set train data matches the pickled recommender's
# training data.
rowHashes = hash_pandas_object(self.results_df).values



# test
data = [10,20,30,40,50,60]
df = pd.DataFrame(data, columns=['Numbers'])
test_df=hash_pandas_object(df).values

print('test_df', test_df)



print('self.results_df', self.results_df)

print('rowHashes', rowHashes)
newHash = hashlib.sha256(rowHashes).hexdigest()

# for rowHash in rowHashes:
# print('rowHash: ', rowHash)

print('newHash', newHash)

# test
test_newHash = hashlib.sha256(b"Nobody inspects the spammish repetition").hexdigest()
print('test_newHash: ', test_newHash)

# temporary fix for pickled recommender's not having a hash
hasattr(self, 'results_df_hash')

print('self.results_df_hash', self.results_df_hash)

print('newHash == self.results_df_hash',newHash == self.results_df_hash)

if hasattr(self, 'results_df_hash'):
if newHash == self.results_df_hash:
logger.info('results_df hashes match')
Expand Down
72 changes: 71 additions & 1 deletion ai/sklearn/config/classifiers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
classifier_config_dict = {

# Original six classifiers
'sklearn.tree.DecisionTreeClassifier': {
'params': {
'criterion': ["gini", "entropy"],
Expand Down Expand Up @@ -75,5 +76,74 @@
'bootstrap': [True, False],
'min_weight_fraction_leaf': [0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45]
}
}
},





# new classifiers
# 'sklearn.ensemble.AdaBoostClassifier': {
# 'params': {
# 'n_estimators': [100, 500],
# 'learning_rate': [0.01, 0.1, 1],
# 'algorithm': ["SAMME", "SAMME.R"]
# }
# },


# 'sklearn.cluster.KMeans': {
# 'params': {
# 'n_clusters': [2, 3, 4, 5, 6, 7, 8, 9, 10],
# 'init': ["k-means++", "random"],
# 'n_init': [10, 20, 30],
# 'max_iter': [100, 200, 300, 400, 500],
# 'tol': [1e-5, 1e-4, 1e-3, 1e-2, 1e-1]
# }
# },

# 'sklearn.naive_bayes.GaussianNB': {
# 'params': {
# 'var_smoothing': [1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1]
# }
# },

# 'sklearn.naive_bayes.MultinomialNB': {
# 'params': {
# 'alpha': [0.0, 0.0001, 0.001, 0.01, 0.1, 1, 10, 100],
# 'fit_prior': [True, False]
# }
# },

# 'sklearn.naive_bayes.BernoulliNB': {
# 'params': {
# 'alpha': [0.0, 0.0001, 0.001, 0.01, 0.1, 1, 10, 100],
# 'fit_prior': [True, False]
# }
# },

# 'sklearn.neural_network.MLPClassifier': {
# 'params': {
# 'hidden_layer_sizes': [(100,), (100, 100), (100, 100, 100)],
# 'activation': ["identity", "logistic", "tanh", "relu"],
# 'solver': ["lbfgs", "sgd", "adam"],
# 'alpha': [0.0001, 0.001, 0.01, 0.1, 1, 10, 100],
# 'learning_rate': ["constant", "invscaling", "adaptive"],
# 'learning_rate_init': [0.0001, 0.001, 0.01, 0.1, 1, 10, 100],
# 'power_t': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
# 'max_iter': [100, 500, 1000, 2000, 5000, 10000],
# 'tol': [1e-5, 1e-4, 1e-3, 1e-2, 1e-1],
# 'momentum': [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
# 'nesterovs_momentum': [True, False],
# 'early_stopping': [True, False],
# 'beta_1': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
# 'beta_2': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
# 'epsilon': [1e-5, 1e-4, 1e-3, 1e-2, 1e-1],
# 'validation_fraction': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
# 'n_iter_no_change': [5, 10, 20, 50, 100]
# }
# }



}
2 changes: 1 addition & 1 deletion config/common.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ MACHINE_HOST=machine
MACHINE_CONFIG=/appsrc/config/machine_config.json
MACHINE_SHAP_SAMPLES_KERNEL_EXPLAINER=50
MACHINE_SHAP_SAMPLES_OTHER_EXPLAINER=100
EXP_TIMEOUT=10
EXP_TIMEOUT=100
DT_MAX_DEPTH=6

STARTUP_DATASET_PATH=/appsrc/data/datasets/user
14 changes: 13 additions & 1 deletion config/machine_config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@



{
"algorithms": ["DecisionTreeClassifier",
"GradientBoostingClassifier",
Expand All @@ -10,5 +13,14 @@
"SVR",
"KNeighborsRegressor",
"KernelRidge",
"RandomForestRegressor"]
"RandomForestRegressor",
"AdaBoostClassifier"
,"KMeans"
,"GaussianNB"
,"MultinomialNB"
,"BernoulliNB"
,"MLPClassifier"
]
}


6 changes: 6 additions & 0 deletions docker/dbmongo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ WORKDIR /opt/

ARG docker_filepath=docker/dbmongo/files

# RUN apt-get update
# RUN apt-get install gpg wget
# RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
# RUN apt-get update


#add repo for mongodb
RUN echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.2.list
RUN apt-get update --fix-missing && \
Expand Down
3 changes: 3 additions & 0 deletions docker/lab/rpi.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ RUN apt-get update --fix-missing && apt-get install -y \
# See: https://stackoverflow.com/a/58562728/1730417
# and: https://askubuntu.com/a/1176271/260220
RUN apt-get update && apt-get install -y software-properties-common
# RUN -E add-apt-repository 'ppa:deadsnakes/ppa'
# RUN -E add-apt-repository ppa:deadsnakes/ppa
# RUN add-apt-repository 'ppa:deadsnakes/ppa'
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get install -y python3.7 python3.7-dev python3.7-distutils
Expand Down
Empty file modified docs/services/docker.fglab.service
100755 → 100644
Empty file.
Empty file modified lab/.gitignore
100755 → 100644
Empty file.
Empty file modified lab/api.raml
100755 → 100644
Empty file.
Empty file modified lab/db.js
100755 → 100644
Empty file.
Empty file modified lab/lab.config.js
100755 → 100644
Empty file.
Empty file modified lab/test/mnist.json
100755 → 100644
Empty file.
Loading