Skip to content

Commit 1505d57

Browse files
Update API reference with task_type in project and description->commit_message
1 parent 2bacd90 commit 1505d57

File tree

1 file changed

+14
-30
lines changed

1 file changed

+14
-30
lines changed

unboxapi/__init__.py

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ def create_project(
108108
.. important::
109109
The project name must be unique in a user's collection of projects.
110110
111+
task_type : :obj:`TaskType`
112+
Type of ML task. E.g. :obj:`TaskType.TabularClassification` or :obj:`TaskType.TextClassification`.
113+
111114
description : str
112115
Project description.
113116
@@ -124,7 +127,9 @@ def create_project(
124127
>>> import unboxapi
125128
>>> client = unboxapi.UnboxClient('YOUR_API_KEY_HERE')
126129
>>>
130+
>>> from unboxapi.tasks import TaskType
127131
>>> project = client.create_project(name="Churn prediction",
132+
... task_type=TaskType.TabularClassification,
128133
... description="My first error analysis playground")
129134
130135
With the Project object created, you are able to start uploading models and datasets
@@ -221,9 +226,6 @@ def add_model(
221226
with a ``name`` that still does not exist inside the project, Unbox treats it as the **first version** of a new model lineage.
222227
On the other hand, if a model with the specified ``name`` already exists inside the project, Unbox treats it as a **new version**
223228
of an existing model lineage.
224-
225-
task_type : :obj:`TaskType`
226-
Type of ML task. E.g. :obj:`TaskType.TextClassification`.
227229
function :
228230
Prediction function object in expected format. Scroll down for examples.
229231
@@ -289,7 +291,9 @@ def add_model(
289291
290292
Then, get the project object. If you don't have a project yet, you need to create one using the :obj:`create_project` method:
291293
294+
>>> from unboxapi.tasks import TaskType
292295
>>> project = client.create_project(name="Your project name",
296+
... task_type=TaskType.TabularClassification, # or some other TaskType
293297
... description="Your project description")
294298
295299
Otherwise, if you already have a project created on the platform, you just need to load it using the :obj:`load_project` method:
@@ -311,7 +315,6 @@ def add_model(
311315
312316
>>> from unboxapi import TaskType
313317
>>>
314-
>>> task_type = TaskType.TabularClassification
315318
>>> class_names = ['Retained', 'Churned']
316319
>>> feature_names = ['CreditScore', 'Geography', 'Balance']
317320
>>> categorical_feature_names = ['Geography']
@@ -367,7 +370,6 @@ def add_model(
367370
>>> model = project.add_model(
368371
... name='Linear classifier',
369372
... commit_message='First iteration of vanilla logistic regression',
370-
... task_type=task_type,
371373
... function=predict_proba,
372374
... model=sklearn_model,
373375
... model_type=model_type,
@@ -390,11 +392,8 @@ def add_model(
390392
2 Things are looking up 1
391393
.. ... ...
392394
393-
The first set of variables needed by Unbox are:
395+
The first variable needed by Unbox is:
394396
395-
>>> from unboxapi import TaskType
396-
>>>
397-
>>> task_type = TaskType.TextClassification
398397
>>> class_names = ['Negative', 'Positive']
399398
400399
Now let's say you've trained a simple ``scikit-learn`` model on data that looks like the above.
@@ -444,7 +443,7 @@ def add_model(
444443
445444
>>> model = project.add_model(
446445
... name='Linear classifier',
447-
... task_type=task_type,
446+
... commit_message='First iteration of vanilla logistic regression',
448447
... function=predict_proba,
449448
... model=sklearn_model,
450449
... model_type=model_type,
@@ -719,8 +718,6 @@ def add_dataset(
719718
720719
Parameters
721720
----------
722-
task_type : :obj:`TaskType`
723-
Type of ML task. E.g. :obj:`TaskType.TextClassification`.
724721
file_path : str
725722
Path to the csv file containing the dataset.
726723
class_names : List[str]
@@ -775,7 +772,9 @@ def add_dataset(
775772
776773
Then, get the project object. If you don't have a project yet, you need to create one using the :obj:`create_project` method:
777774
775+
>>> from unboxapi.tasks import TaskType
778776
>>> project = client.create_project(name="Your project name",
777+
... task_type=TaskType.TabularClassification, # or some other TaskType
779778
... description="Your project description")
780779
781780
Otherwise, if you already have a project created on the platform, you just need to load it using the :obj:`load_project` method:
@@ -799,9 +798,6 @@ def add_dataset(
799798
800799
The variables are needed by Unbox are:
801800
802-
>>> from unboxapi import TaskType
803-
>>>
804-
>>> task_type = TaskType.TabularClassification
805801
>>> class_names = ['Retained', 'Churned']
806802
>>> feature_names = ['CreditScore', 'Geography', 'Balance']
807803
>>> label_column_name = 'Churned'
@@ -810,7 +806,6 @@ def add_dataset(
810806
You can now upload this dataset to Unbox:
811807
812808
>>> dataset = client.add_dataset(
813-
... task_type=task_type,
814809
... file_path='/path/to/dataset.csv',
815810
... commit_message="First commit!",
816811
... class_names=class_names,
@@ -833,18 +828,15 @@ def add_dataset(
833828
834829
The variables are needed by Unbox are:
835830
836-
>>> from unboxapi import TaskType
837-
>>>
838-
>>> task_type = TaskType.TextClassification
839831
>>> class_names = ['Negative', 'Positive']
840832
>>> text_column_name = 'Text'
841833
>>> label_column_name = 'Sentiment'
842834
843835
You can now upload this dataset to Unbox:
844836
845837
>>> dataset = client.add_dataset(
846-
... task_type=task_type,
847838
... file_path='/path/to/dataset.csv',
839+
... commit_message="First commit!",
848840
... class_names=class_names,
849841
... label_column_name=label_column_name,
850842
... text_column_name=text_column_name,
@@ -1004,8 +996,6 @@ def add_dataframe(
1004996
1005997
Parameters
1006998
----------
1007-
task_type : :obj:`TaskType`
1008-
Type of ML task. E.g. :obj:`TaskType.TextClassification`.
1009999
df : pd.DataFrame
10101000
Dataframe containing your dataset.
10111001
class_names : List[str]
@@ -1058,7 +1048,9 @@ def add_dataframe(
10581048
10591049
Then, get the project object. If you don't have a project yet, you need to create one using the :obj:`create_project` method:
10601050
1051+
>>> from unboxapi.tasks import TaskType
10611052
>>> project = client.create_project(name="Your project name",
1053+
... task_type=TaskType.TabularClassification # or some other TaskType
10621054
... description="Your project description")
10631055
10641056
Otherwise, if you already have a project created on the platform, you just need to load it using the :obj:`load_project` method:
@@ -1081,9 +1073,6 @@ def add_dataframe(
10811073
10821074
The variables are needed by Unbox are:
10831075
1084-
>>> from unboxapi import TaskType
1085-
>>>
1086-
>>> task_type = TaskType.TabularClassification
10871076
>>> class_names = ['Retained', 'Churned']
10881077
>>> feature_names = ['CreditScore', 'Geography', 'Balance']
10891078
>>> label_column_name = 'Churned'
@@ -1092,7 +1081,6 @@ def add_dataframe(
10921081
You can now upload this dataset to Unbox:
10931082
10941083
>>> dataset = client.add_dataset(
1095-
... task_type=task_type,
10961084
... df=df,
10971085
... commit_message="First commit!",
10981086
... class_names=class_names,
@@ -1114,17 +1102,13 @@ def add_dataframe(
11141102
11151103
The variables are needed by Unbox are:
11161104
1117-
>>> from unboxapi import TaskType
1118-
>>>
1119-
>>> task_type = TaskType.TextClassification
11201105
>>> class_names = ['Negative', 'Positive']
11211106
>>> text_column_name = 'Text'
11221107
>>> label_column_name = 'Sentiment'
11231108
11241109
You can now upload this dataset to Unbox:
11251110
11261111
>>> dataset = client.add_dataset(
1127-
... task_type=task_type,
11281112
... df=df,
11291113
... commit_message="First commit!",
11301114
... class_names=class_names,

0 commit comments

Comments
 (0)