Skip to content

Commit

Permalink
fix(JAQPOT-407): remove extra config (#107)
Browse files Browse the repository at this point in the history
* fix(JAQPOT-407): remove extra config

* fix: update api files

* chore: reformat files

* fix: build

* chore: do not reformat openapi files
  • Loading branch information
alarv authored Nov 5, 2024
1 parent 08b4076 commit 531f7aa
Show file tree
Hide file tree
Showing 134 changed files with 3,367 additions and 6,845 deletions.
2 changes: 0 additions & 2 deletions examples/example_classification_StringLabels.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
)
from jaqpotpy.datasets import JaqpotpyDataset
from jaqpotpy.models import SklearnModel
from jaqpotpy.doa import Leverage
from jaqpotpy import Jaqpot

path = "jaqpotpy/test_data/test_data_smiles_CATEGORICAL_classification_LABELS_new.csv"
Expand Down Expand Up @@ -73,7 +72,6 @@
print(cross_val_scores["output_0"]["fold_1"]["confusionMatrix"])
print(cross_val_scores["output_0"]["fold_3"]["confusionMatrix"])


# skl_predictions = molecularModel_t1.predict(prediction_dataset)
# # skl_probabilities = molecularModel_t1.predict_proba(prediction_dataset)
# onnx_predictions = molecularModel_t1.predict_onnx(prediction_dataset)
Expand Down
2 changes: 0 additions & 2 deletions examples/one_hot_encoding_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
)
from jaqpotpy.datasets import JaqpotpyDataset
from jaqpotpy.models import SklearnModel
from jaqpotpy.doa import Leverage
from jaqpotpy import Jaqpot

path = "jaqpotpy/test_data/test_data_smiles_CATEGORICAL_classification.csv"
Expand Down Expand Up @@ -40,7 +39,6 @@
remainder="passthrough",
)


model = RandomForestClassifier(random_state=42)
molecularModel_t1 = SklearnModel(
dataset=dataset,
Expand Down
36 changes: 19 additions & 17 deletions examples/onnx_example_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
from jaqpotpy.doa import Leverage, BoundingBox, MeanVar
from jaqpotpy import Jaqpot

path = "jaqpotpy/test_data/test_data_smiles_CATEGORICAL_classification_LABELS_new.csv"
path = (
"../jaqpotpy/test_data/test_data_smiles_CATEGORICAL_classification_LABELS_new.csv"
)

df = pd.read_csv(path).iloc[0:100, :]
smiles_cols = ["SMILES"]
Expand Down Expand Up @@ -42,7 +44,7 @@
)

molecularModel_t1.fit()
pred_path = "./jaqpotpy/test_data/test_data_smiles_categorical_prediction_dataset.csv"
pred_path = "../jaqpotpy/test_data/test_data_smiles_categorical_prediction_dataset.csv"
test_dataset = pd.read_csv(pred_path)

prediction_dataset = JaqpotpyDataset(
Expand All @@ -69,20 +71,20 @@
# print("ONNX Probabilities:", onnx_probs)

# Upload locally
# jaqpot = Jaqpot(
# base_url="http://localhost.jaqpot.org",
# app_url="http://localhost.jaqpot.org:3000",
# login_url="http://localhost.jaqpot.org:8070",
# api_url="http://localhost.jaqpot.org:8080",
# keycloak_realm="jaqpot-local",
# keycloak_client_id="jaqpot-local-test",
# )
jaqpot = Jaqpot(
base_url="http://localhost.jaqpot.org",
app_url="http://localhost.jaqpot.org:3000",
login_url="http://localhost.jaqpot.org:8070",
api_url="http://localhost.jaqpot.org:8080",
keycloak_realm="jaqpot-local",
keycloak_client_id="jaqpot-local-test",
)

# jaqpot = Jaqpot()
# jaqpot.login()
# molecularModel_t1.deploy_on_jaqpot(
# jaqpot=jaqpot,
# name="Demo: Regression topological and minmax scaler on y",
# description="Test",
# visibility="PRIVATE",
# )
jaqpot.login()
molecularModel_t1.deploy_on_jaqpot(
jaqpot=jaqpot,
name="Demo: Regression topological and minmax scaler on y",
description="Test",
visibility="PRIVATE",
)
28 changes: 14 additions & 14 deletions examples/sdk_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,48 @@
jaqpot = JaqpotApiClient()

# Get a model by id
model = jaqpot.get_model_by_id(model_id=1691) # 1812)
model = jaqpot.get_model_by_id(model_id=1860) # 1812)
print(model)
#
#
# # Get model summary
# model_summary = jaqpot.get_model_summary(model_id=1691)
# print(model_summary)
#
#
# # Get shared models with organization
# shared_models = jaqpot.get_shared_models()
# print(shared_models)
#
#
# # # Take a synchronous prediction with a model
# input_data = [{"SMILES": "CC", "X1": 1, "X2": 2}]
# prediction = jaqpot.predict_sync(model_id=1852, dataset=input_data)
# print(prediction)
#
input_data = [{"SMILES": "CC", "X1": 1, "X2": 2, "Cat_col": "CAT_1"}]
prediction = jaqpot.predict_sync(model_id=1853, dataset=input_data)
print(prediction)
#
# # Take an asynchronous prediction with a model
# input_data = [{"SMILES": "CC", "X1": 1, "X2": 2}]
# prediction = jaqpot.predict_async(model_id=1812, dataset=input_data)
#
#
# # Take prediction with a model and a csv file
# csv_path = "/Users/vassilis/Desktop/test_csv.csv"
# prediction = jaqpot.predict_with_csv_sync(model_id=1812, csv_path=csv_path)
# print(prediction)
#
#
#
#
# # Testing QsarToolBox
# get_model = jaqpot.get_model_by_id(model_id=6)
# print(get_model)
#
#
# # Test QsarToolBox calculator
# prediction = jaqpot.qsartoolbox_calculator_predict_sync(
# smiles="CC", calculator_guid="1804a854-9041-4495-9931-7414c22a5e49"
# )
# print(prediction)
#
#
# # Test QsarToolBox Model
# prediction = jaqpot.qsartoolbox_qsar_model_predict_sync(
# smiles="CC", qsar_guid="c377150b-77ae-4f99-be14-357b85dd8d1f"
# )
# print(prediction)
#
#
# # Test QsarToolBox Profiler
# prediction = jaqpot.qsartoolbox_profiler_predict_sync(
# smiles="CC", profiler_guid="723eb011-3e5b-4565-9358-4c3d8620ba5d"
Expand Down
35 changes: 17 additions & 18 deletions examples/upload_on_jaqpot_example.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import pandas as pd
from jaqpotpy.doa import Leverage, MeanVar, BoundingBox
from sklearn.ensemble import RandomForestRegressor
from sklearn.preprocessing import StandardScaler, MinMaxScaler

from jaqpotpy.descriptors.molecular import TopologicalFingerprint, MordredDescriptors
from jaqpotpy.datasets import JaqpotpyDataset
from jaqpotpy.models import SklearnModel
from jaqpotpy.doa import Leverage
from jaqpotpy.models.preprocessing import Preprocess
from jaqpotpy import Jaqpot

path = "./jaqpotpy/test_data/test_data_smiles_regression.csv"
path = "../jaqpotpy/test_data/test_data_smiles_regression.csv"

df = pd.read_csv(path).iloc[0:100, :]
smiles_cols = ["SMILES"]
Expand All @@ -24,15 +23,15 @@
task="regression",
featurizer=featurizer,
)
pre = Preprocess()
# pre.register_preprocess_class("Standard Scaler", StandardScaler())
# pre.register_preprocess_class_y("minmax_y", MinMaxScaler())

model = RandomForestRegressor(random_state=42)
doa_method = Leverage()
molecularModel_t1 = SklearnModel(
dataset=dataset, doa=None, model=model, preprocessor=None, cv=None
)
doa_methods = []
doa_methods.append(Leverage())
doa_methods.append(MeanVar())
doa_methods.append(BoundingBox())
molecularModel_t1 = SklearnModel(dataset=dataset, doa=doa_methods, model=model)

molecularModel_t1.fit()
# # # print(molecularModel_t1.transformers_y)
Expand Down Expand Up @@ -76,17 +75,17 @@
# print(df_predictions)


# # # # Upload locally
# # jaqpot = Jaqpot(
# # base_url="http://localhost.jaqpot.org",
# # app_url="http://localhost.jaqpot.org:3000",
# # login_url="http://localhost.jaqpot.org:8070",
# # api_url="http://localhost.jaqpot.org:8080",
# # keycloak_realm="jaqpot-local",
# # keycloak_client_id="jaqpot-local-test",
# # )
# Upload locally
jaqpot = Jaqpot(
base_url="http://localhost.jaqpot.org",
app_url="http://localhost.jaqpot.org:3000",
login_url="http://localhost.jaqpot.org:8070",
api_url="http://localhost.jaqpot.org:8080",
keycloak_realm="jaqpot-local",
keycloak_client_id="jaqpot-local-test",
)

jaqpot = Jaqpot()
# jaqpot = Jaqpot()
jaqpot.login()
molecularModel_t1.deploy_on_jaqpot(
jaqpot=jaqpot,
Expand Down
10 changes: 5 additions & 5 deletions jaqpotpy/api/jaqpot_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@

class JaqpotApiClient:
def __init__(
self,
base_url=None,
api_url=None,
create_logs=False,
self,
base_url=None,
api_url=None,
create_logs=False,
):
# logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
self.log = init_logger(
Expand Down Expand Up @@ -247,7 +247,7 @@ def _get_dataset_with_polling(self, response):
try:
polling2.poll(
lambda: self.get_dataset_by_id(dataset_id).status
in ["SUCCESS", "FAILURE"],
in ["SUCCESS", "FAILURE"],
step=3,
timeout=60,
)
Expand Down
2 changes: 1 addition & 1 deletion jaqpotpy/api/jaqpot_api_client_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def build_with_access_token(self, access_token):

def build_with_api_keys(self, api_key, api_secret):
if api_key is None or api_secret is None:
raise ValueError('api_key and api_secret must be set')
raise ValueError("api_key and api_secret must be set")
self.http_client.set_default_header("X-Api-Key", api_key)
self.http_client.set_default_header("X-Api-Secret", api_secret)
return self
Expand Down
38 changes: 0 additions & 38 deletions jaqpotpy/api/openapi/.github/workflows/python.yml

This file was deleted.

66 changes: 0 additions & 66 deletions jaqpotpy/api/openapi/.gitignore

This file was deleted.

31 changes: 0 additions & 31 deletions jaqpotpy/api/openapi/.gitlab-ci.yml

This file was deleted.

Loading

0 comments on commit 531f7aa

Please sign in to comment.