Skip to content

Commit ad904df

Browse files
Merge pull request #9 from learningOrchestra/bug-fixes
Bug fixes
2 parents b89a8a2 + 9a35e22 commit ad904df

5 files changed

Lines changed: 22 additions & 15 deletions

File tree

Pipfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ verify_ssl = true
77

88
[packages]
99
requests = "2.4.2"
10-
Pillow = "8.0.1"
1110
pymongo = "3.11.1"
1211

1312
[requires]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ Each functionality in learningOrchestra is contained in its own class. Check the
2525

2626
* [Here](examples/titanic.py) has an example using the [Titanic Dataset](https://www.kaggle.com/c/titanic/overview):
2727
* [Here](examples/sentiment_analysis.py) has an example using the [Sentiment Analysis On IMDb reviews](https://www.kaggle.com/avnika22/imdb-perform-sentiment-analysis-with-scikit-learn):
28-
* [Here](examples/mnist.py) has an example using the [MNIST Dataset](http://yann.lecun.com/exdb/mnist/):
28+
* [Here](examples/mnist_async.py) has an example using the [MNIST Dataset](http://yann.lecun.com/exdb/mnist/):
2929

3030

examples/mnist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ def treat_dataset(dataset: dict) -> tuple:
247247

248248

249249
show_mnist_evaluate = '''
250-
print(mnist_evaluated)
251-
response = None
250+
print(mnist_evaluated)
251+
response = None
252252
'''
253253
function_python.run_function_async(
254254
name="mnist_model_evaluated_print",

examples/sentiment_analysis.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from learning_orchestra_client.train.scikitlearn import TrainScikitLearn
55
from learning_orchestra_client.predict.scikitlearn import PredictScikitLearn
66

7-
CLUSTER_IP = "http://34.68.100.96"
7+
CLUSTER_IP = "http://34.123.167.241"
88

99
dataset_csv = DatasetCsv(CLUSTER_IP)
1010

@@ -107,12 +107,12 @@ def tokenizer_porter(text):
107107
module_path="sklearn.linear_model",
108108
class_name="LogisticRegressionCV",
109109
class_parameters={
110-
"cv": 6,
110+
"cv": 5,
111111
"scoring": "accuracy",
112112
"random_state": 0,
113113
"n_jobs": -1,
114114
"verbose": 3,
115-
"max_iter": 500
115+
"max_iter": 100
116116
}
117117

118118
)

examples/titanic.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
from learning_orchestra_client.transform.data_type import TransformDataType
44
from learning_orchestra_client.builder import BuilderSparkMl
55

6-
CLUSTER_IP = "http://34.66.75.31"
6+
CLUSTER_IP = "http://35.193.116.104"
77

88
dataset_csv = DatasetCsv(CLUSTER_IP)
99

1010
dataset_csv.insert_dataset_async(
11-
url="https://filebin.net/r4b6z6sganz2opsh/train.csv?t=9d3lp7jm",
11+
url="https://filebin.net/boniydu54k710l54/train.csv?t=s350xryf",
1212
dataset_name="titanic_training",
1313
)
1414
dataset_csv.insert_dataset_async(
15-
url="https://filebin.net/r0c41p538us5fcrz/test.csv?t=td68r02h",
15+
url="https://filebin.net/udtf7eogfgasqnx5/test.csv?t=h79pcy0l",
1616
dataset_name="titanic_testing"
1717
)
1818

@@ -41,7 +41,7 @@
4141

4242
transform_projection.remove_dataset_attributes_async(
4343
dataset_name="titanic_training",
44-
projection_name="titanic_training_projection4",
44+
projection_name="titanic_training_projection",
4545
fields=required_columns)
4646

4747
required_columns.remove("Survived")
@@ -174,8 +174,11 @@
174174
training_df = datasets_list[TRAINING_DF_INDEX]
175175
testing_df = datasets_list[TESTING_DF_INDEX]
176176
177+
columns_without_label = training_df.columns.copy()
178+
columns_without_label.remove("label")
179+
177180
assembler = VectorAssembler(
178-
inputCols=training_df.columns[:],
181+
inputCols=columns_without_label,
179182
outputCol="features")
180183
assembler.setHandleInvalid('skip')
181184
@@ -192,7 +195,12 @@
192195
modeling_code=modeling_code,
193196
model_classifiers=["LR", "DT", "GB", "RF", "NB"])
194197

195-
for prediction in result["result"]:
196-
builder.wait(dataset_name=prediction)
198+
PREDICTION_NAME_INDEX_IN_URL = 6
199+
INDEX_TO_REMOVE_URI_PARAMETERS = 0
200+
for prediction_url in result["result"]:
201+
prediction_name = prediction_url. \
202+
split("/")[PREDICTION_NAME_INDEX_IN_URL]. \
203+
split("?")[INDEX_TO_REMOVE_URI_PARAMETERS]
204+
builder.wait(dataset_name=prediction_name)
197205
print(builder.search_builder_register_predictions(
198-
builder_name=prediction, limit=1, pretty_response=True))
206+
builder_name=prediction_name, limit=1, pretty_response=True))

0 commit comments

Comments
 (0)