openml / automlbenchmark

OpenML AutoML Benchmarking Framework
https://openml.github.io/automlbenchmark
MIT License
398 stars 132 forks source link

Add new framework: mljar-supervised #102

Closed pplonski closed 4 years ago

pplonski commented 4 years ago

I'm working on AutoML python package: mljar-supervised. I would like to add it to automlbenchmark.

I successfully run through 1-9 points from HOWTO::Add default framework

I stuck at 10 (docker integration) and 11 (aws).

For docker I susspect I had problem with privilages:

python3 runbenchmark.py supervised -m docker
Running `supervised` on `test` benchmarks in `docker` mode.
Loading frameworks definitions from /home/piotr/sandbox/automlbenchmark/resources/frameworks.yaml.
Loading benchmark constraint definitions from /home/piotr/sandbox/automlbenchmark/resources/constraints.yaml.
Loading benchmark definitions from /home/piotr/sandbox/automlbenchmark/resources/benchmarks/test.yaml.
Running cmd `docker images -q automlbenchmark/supervised:0.2.6-stable`
WARNING: Error loading config file: /home/piotr/.docker/config.json: stat /home/piotr/.docker/config.json: permission denied
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/images/json?filters=%7B%22reference%22%3A%7B%22automlbenchmark%2Fsupervised%3A0.2.6-stable%22%3Atrue%7D%7D: dial unix /var/run/docker.sock: connect: permission denied

For aws I got a lot of loga and then errors:

[  119.518648] cloud-init[1475]:     Running setup.py install for openml: finished with status 'done'
[  119.545129] cloud-init[1475]: Successfully installed Babel-2.8.0 PyYAML-5.3.1 attrs-19.3.0 certifi-2020.4.5.1 chardet-3.0.4 debtcollector-2.0.1 decorator-4.4.2 fasteners-0.15 idna-2.9 importlib-metadata-1.6.0 ipython-genutils-0.2.0 iso8601-0.1.12 jsonschema-3.2.0 jupyter-core-4.6.3 mock-4.0.2 monotonic-1.5 nbformat-5.0.6 netaddr-0.7.19 netifaces-0.10.9 nose-1.3.7 openml-0.7.0 oslo.concurrency-4.0.2 oslo.config-8.0.2 oslo.i18n-4.0.1 oslo.utils-4.1.1 pbr-5.4.5 pyparsing-2.4.7 pyrsistent-0.16.0 requests-2.23.0 rfc3986-1.4.0 stevedore-1.32.0 traitlets-4.3.3 wrapt-1.12.1 xmltodict-0.12.0 zipp-3.1.0
[  122.904087] cloud-init[1475]: Running `supervised` on `test` benchmarks in `local` mode.
[  122.935523] cloud-init[1475]: Loading frameworks definitions from /repo/resources/frameworks.yaml.
[  122.950187] cloud-init[1475]: ERROR:
[  122.952154] cloud-init[1475]: Incorrect framework `supervised`: not listed in /repo/resources/frameworks.yaml.
[  123.826013] cloud-init[1475]: Running `supervised` on `test` benchmarks in `local` mode.
[  123.858485] cloud-init[1475]: Loading frameworks definitions from /repo/resources/frameworks.yaml.
[  123.873685] cloud-init[1475]: ERROR:
[  123.873797] cloud-init[1475]: Incorrect framework `supervised`: not listed in /repo/resources/frameworks.yaml.
[  125.065343] cloud-init[1475]: upload failed: ../s3bucket/output/logs/runbenchmark_20200421T132409.log to s3://automl-benchmark/ec2/supervised_test_test_aws_20200421T131523/aws_test_test_all__supervised/output/logs/runbenchmark_20200421T132409.log An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
[  125.085960] cloud-init[1475]: Completed 17.1 KiB/34.9 KiB (0 Bytes/s) with 3 file(s) remaining
upload failed: ../s3bucket/output/logs/runbenchmark_20200421T132410_full.log to s3://automl-benchmark/ec2/supervised_test_test_aws_20200421T131523/aws_test_test_all__supervised/output/logs/runbenchmark_20200421T132410_full.log An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
[  125.099099] cloud-init[1475]: Completed 17.4 KiB/34.9 KiB (0 Bytes/s) with 2 file(s) remaining
upload failed: ../s3bucket/output/logs/runbenchmark_20200421T132409_full.log to s3://automl-benchmark/ec2/supervised_test_test_aws_20200421T131523/aws_test_test_all__supervised/output/logs/runbenchmark_20200421T132409_full.log An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
[  125.104312] cloud-init[1475]: Completed 17.7 KiB/34.9 KiB (0 Bytes/s) with 1 file(s) remaining
upload failed: ../s3bucket/output/logs/runbenchmark_20200421T132410.log to s3://automl-benchmark/ec2/supervised_test_test_aws_20200421T131523/aws_test_test_all__supervised/output/logs/runbenchmark_20200421T132410.log An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
ci-info: no authorized ssh keys fingerprints found for user ubuntu.

My code is here: https://github.com/pplonski/automlbenchmark/tree/master/frameworks/supervised

I would ask for some tips, what can be a problem with aws setup? (I think I will handle docker problem myself)

pplonski commented 4 years ago

I'm really impressed with aws mode. I like the feature which copy results from aws to my local folder.

PGijsbers commented 4 years ago

Good to hear you managed to overcome the issues :) looking forward to the PR.

pplonski commented 4 years ago

It was working all good when I was testing with simple baseline algorithms. When I've added LightGBM and Xgboost I started to have strange errors:

ERROR:frameworks.shared.callee:DataFrame.dtypes for data must be int, float or bool.
Did not expect the data types in the following fields: f0, f1, f2, f3
Traceback (most recent call last):
  File "/home/piotr/sandbox/automlbenchmark/frameworks/shared/callee.py", line 121, in call_run
    result = run_fn(ds, config)
  File "/home/piotr/sandbox/automlbenchmark/frameworks/supervised/exec.py", line 66, in run
    print(automl.predict(X_train))
  File "/home/piotr/sandbox/automlbenchmark/frameworks/supervised/venv/lib/python3.7/site-packages/supervised/automl.py", line 722, in predict
    predictions = self._best_model.predict(X)
  File "/home/piotr/sandbox/automlbenchmark/frameworks/supervised/venv/lib/python3.7/site-packages/supervised/model_framework.py", line 208, in predict
    y_p = learner.predict(X_data)
  File "/home/piotr/sandbox/automlbenchmark/frameworks/supervised/venv/lib/python3.7/site-packages/supervised/algorithms/lightgbm.py", line 71, in predict
    return self.model.predict(X)
  File "/home/piotr/sandbox/automlbenchmark/frameworks/supervised/venv/lib/python3.7/site-packages/lightgbm/basic.py", line 2415, in predict
    data_has_header, is_reshape)
  File "/home/piotr/sandbox/automlbenchmark/frameworks/supervised/venv/lib/python3.7/site-packages/lightgbm/basic.py", line 504, in predict
    data = _data_from_pandas(data, None, None, self.pandas_categorical)[0]
  File "/home/piotr/sandbox/automlbenchmark/frameworks/supervised/venv/lib/python3.7/site-packages/lightgbm/basic.py", line 344, in _data_from_pandas
    + ', '.join(data.columns[bad_indices]))
ValueError: DataFrame.dtypes for data must be int, float or bool.
Did not expect the data types in the following fields: f0, f1, f2, f3
62bb0f1c-8545-11ea-a8e1-2c56dc4a8211
{"error_message":"DataFrame.dtypes for data must be int, float or bool.\nDid not expect the data types in the following fields: f0, f1, f2, f3","models_count":0}

DataFrame.dtypes for data must be int, float or bool.
Did not expect the data types in the following fields: f0, f1, f2, f3
Traceback (most recent call last):
  File "/home/piotr/sandbox/automlbenchmark/amlb/benchmark.py", line 409, in run
    meta_result = framework.run(self._dataset, task_config)
  File "/home/piotr/sandbox/automlbenchmark/frameworks/supervised/__init__.py", line 29, in run
    input_data=data, dataset=dataset, config=config)
  File "/home/piotr/sandbox/automlbenchmark/frameworks/shared/caller.py", line 71, in run_in_venv
    raise NoResultError(res.error_message)
amlb.results.NoResultError: DataFrame.dtypes for data must be int, float or bool.
Did not expect the data types in the following fields: f0, f1, f2, f3
Metric scores: { 'acc': nan,
  'duration': nan,
  'fold': 0,
  'framework': 'supervised',
  'id': 'openml.org/t/59',
  'info': 'NoResultError: DataFrame.dtypes for data must be int, float or '
          'bool.\n'
          'Did not expect the data types in the following fields: f0, f1, f2, '
          'f3',
  'logloss': nan,
  'mode': 'local',
  'models': nan,
  'params': '',
  'result': nan,
  'seed': 2911488517,
  'tag': None,
  'task': 'iris',
  'utc': '2020-04-23T09:33:57',
  'version': '0.2.8'}

I get errors when running predict. The fit method works. Then predict even if on the X_train data raise such error. Have you ever expect such errors?

Edit: look like something on my side ...

sebhrusen commented 4 years ago

Hi @pplonski , never seen this error before.

DataFrame.dtypes for data must be int, float or bool

It looks like with lightgbm, your predict requires categorical columns to be encoded. Which is weird if it was not required for training.

pplonski commented 4 years ago

I've found the reason :)

  1. I'm using raw data. Without any preprocessing.
  2. Raw data will be type object (for all columns) if at least one column is not numeric. Even in the case of the Iris dataset, input data was object because target column is not numeric. (I assume that X and y data is read from one file, and that's why the type).
  3. To solve the problem and set the proper data type for each column I'm doing casting to float for each column.
sebhrusen commented 4 years ago

input data was object because target column is not numeric

yes, I noticed this recently too and I'm thinking about "fixing" this for arff files as we know the column types (at least numeric vs categoricals). It's possible that other libraries rely on the ndarray dtypes, although haven't seen any issue until now.

pplonski commented 4 years ago

I think, that there might be no issue because most of the frameworks are working on encoded data, which is all numeric.

pplonski commented 4 years ago

I created PR https://github.com/openml/automlbenchmark/pull/105 with mljar-supervised.

The mljar-supervised version is 0.2.8. It is still in development. I hope I will soon PR with newer version.

The framework should work in all modes: local, docker and aws.

I would like to add mljar-supervised results from benchmarks to reports or website. Do you have steps how to do it?