|
| 1 | +from __future__ import print_function |
1 | 2 | import os |
2 | 3 | import uuid |
3 | 4 | import sys |
4 | 5 | import json, requests |
5 | 6 | import time |
6 | 7 | import numpy as np |
7 | 8 |
|
8 | | -from utils import * |
9 | | -from exceptions import IncorrectInputDataException, UndefinedExperimentException |
10 | | -from exceptions import MljarException, BadValueException |
| 9 | +from .utils import * |
| 10 | +from .exceptions import IncorrectInputDataException, UndefinedExperimentException |
| 11 | +from .exceptions import MljarException, BadValueException |
11 | 12 |
|
12 | | -from client.project import ProjectClient |
13 | | -from client.dataset import DatasetClient |
14 | | -from client.experiment import ExperimentClient |
15 | | -from client.result import ResultClient |
16 | | -from client.prediction import PredictionClient |
17 | | -from client.predictjob import PredictJobClient |
18 | | -from client.prediction_download import PredictionDownloadClient |
| 13 | +from .client.project import ProjectClient |
| 14 | +from .client.dataset import DatasetClient |
| 15 | +from .client.experiment import ExperimentClient |
| 16 | +from .client.result import ResultClient |
| 17 | +from .client.prediction import PredictionClient |
| 18 | +from .client.predictjob import PredictJobClient |
| 19 | +from .client.prediction_download import PredictionDownloadClient |
19 | 20 |
|
20 | | -from log import logger |
| 21 | +from .log import logger |
21 | 22 |
|
22 | 23 | class Mljar(object): |
23 | 24 | ''' |
@@ -145,7 +146,7 @@ def fit(self, X, y, validation_data = None, wait_till_all_done = True, dataset_t |
145 | 146 | try: |
146 | 147 | self._start_experiment(X, y, validation_data, dataset_title) |
147 | 148 | except Exception as e: |
148 | | - print 'Ups, %s' % str(e) |
| 149 | + print('Ups, {0}'.format(str(e))) |
149 | 150 |
|
150 | 151 |
|
151 | 152 | def _start_experiment(self, X, y, validation_data = None, dataset_title = None): |
@@ -228,7 +229,7 @@ def _wait_till_all_models_trained(self): |
228 | 229 | if current_error_cnt >= max_error_cnt: |
229 | 230 | break |
230 | 231 | logger.info('Get the best result') |
231 | | - print '' # add new line |
| 232 | + print('') # add new line |
232 | 233 | # get the best result! |
233 | 234 | return self._get_the_best_result(results) |
234 | 235 |
|
@@ -274,21 +275,21 @@ def _get_the_best_result(self, results): |
274 | 275 |
|
275 | 276 | def predict(self, X): |
276 | 277 | if self.project is None or self.experiment is None: |
277 | | - print 'Can not run prediction.' |
278 | | - print 'Please run fit method first, to start models training and to retrieve them ;)' |
| 278 | + print('Can not run prediction.') |
| 279 | + print('Please run fit method first, to start models training and to retrieve them ;)') |
279 | 280 | return None |
280 | 281 | if self.selected_algorithm is None: |
281 | 282 | results = ResultClient(self.project.hid).get_results(self.experiment.hid) |
282 | 283 | self.selected_algorithm = self._get_the_best_result(results) |
283 | 284 | if self.experiment.compute_now != 2: |
284 | 285 | if self.selected_algorithm is not None: |
285 | | - print 'DISCLAIMER:' |
286 | | - print 'Your experiment is not yet finished.' |
287 | | - print 'You will use the best model up to now.' |
288 | | - print 'You can obtain better results if you wait till experiment is finished.' |
| 286 | + print('DISCLAIMER:') |
| 287 | + print('Your experiment is not yet finished.') |
| 288 | + print('You will use the best model up to now.') |
| 289 | + print('You can obtain better results if you wait till experiment is finished.') |
289 | 290 | else: |
290 | | - print 'There is no ready model to use for prediction.' |
291 | | - print 'Please wait and try in a moment' |
| 291 | + print('There is no ready model to use for prediction.') |
| 292 | + print('Please wait and try in a moment') |
292 | 293 | return None |
293 | 294 |
|
294 | 295 | if self.selected_algorithm is not None: |
|
0 commit comments