Skip to content

Commit 67482f8

Browse files
authored
Add usage snippet to docs page (#434)
* ADD introductory snippet to front page of the docs * FIX issues with rst formatting
1 parent 9b9a857 commit 67482f8

File tree

3 files changed

+57
-23
lines changed

3 files changed

+57
-23
lines changed

doc/index.rst

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,39 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to OpenML's documentation!
7-
==================================
8-
9-
The OpenML module is still under development. You can watch its progress
10-
:ref:`here <progress>`.
6+
======
7+
OpenML
8+
======
9+
10+
Welcome to the documentation of the OpenML Python API, a connector to the
11+
collaborative machine learning platform `OpenML.org <https://www.openml.org>`_.
12+
The OpenML Python package allows to use datasets and tasks from OpenML together
13+
with scikit-learn and share the results online.
14+
15+
-------
16+
Example
17+
-------
18+
19+
.. code:: python
20+
21+
# Define a scikit-learn pipeline
22+
clf = sklearn.pipeline.Pipeline(
23+
steps=[
24+
('imputer', sklearn.preprocessing.Imputer()),
25+
('estimator', sklearn.tree.DecisionTreeClassifier())
26+
]
27+
)
28+
# Download the OpenML task for the german credit card dataset with 10-fold
29+
# cross-validation.
30+
task = openml.tasks.get_task(31)
31+
# Set the OpenML API Key which is required to upload the runs.
32+
# You can get your own API by signing up to OpenML.org.
33+
openml.config.apikey = 'ABC'
34+
# Run the scikit-learn model on the task (requires an API key).
35+
run = openml.runs.run_model_on_task(task, clf)
36+
# Publish the experiment on OpenML (optional, requires an API key).
37+
run.publish()
38+
print('URL for run: %s/run/%d' % (openml.config.server, run.run_id))
1139
1240
1341
------------

openml/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from .runs import OpenMLRun
2929
from .tasks import OpenMLTask, OpenMLSplit
3030
from .flows import OpenMLFlow
31+
from .evaluations import OpenMLEvaluation
3132

3233
from .__version__ import __version__
3334

openml/evaluations/evaluation.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@ class OpenMLEvaluation(object):
55
according to the evaluation/list function
66
77
Parameters
8-
----------
9-
run_id : int
10-
task_id : int
11-
setup_id : int
12-
flow_id : int
13-
flow_name : str
14-
data_id : int
15-
data_name : str
16-
the name of the dataset
17-
function : str
18-
the evaluation function of this item (e.g., accuracy)
19-
upload_time : str
20-
the time of evaluation
21-
value : float
22-
the value of this evaluation
23-
array_data : str
24-
list of information per class (e.g., in case of precision, auroc,
25-
recall)
8+
----------
9+
run_id : int
10+
11+
task_id : int
12+
13+
setup_id : int
14+
15+
flow_id : int
16+
17+
flow_name : str
18+
19+
data_id : int
20+
21+
data_name : str
22+
the name of the dataset
23+
function : str
24+
the evaluation function of this item (e.g., accuracy)
25+
upload_time : str
26+
the time of evaluation
27+
value : float
28+
the value of this evaluation
29+
array_data : str
30+
list of information per class (e.g., in case of precision, auroc, recall)
2631
'''
2732
def __init__(self, run_id, task_id, setup_id, flow_id, flow_name,
2833
data_id, data_name, function, upload_time, value,

0 commit comments

Comments
 (0)