Unbox
Search…
unboxapi.UnboxClient

Usage

1
import unboxapi
2
3
# Instantiate a client instance with your API key
4
# The API key can be found in the account page inside the app
5
unboxapi.UnboxClient(api_key: str)
Copied!

Methods

1
class UnboxClient
Copied!
Client class that interacts with the Unbox Platform.

add_dataframe

1
def add_dataframe(self,
2
df: pandas.core.frame.DataFrame,
3
class_names: List[str],
4
label_column_name: str,
5
text_column_name: str,
6
name: str,
7
description: str)> Dataset
Copied!
Uploads a dataset from a dataframe.

Args

1
# Dataframe object
2
df: pd.DataFrame
3
4
# List of class names indexed by label integer in the dataset
5
# ex. [negative, positive] when [0, 1] are labels in the csv
6
class_names: List[str]
7
8
# Column header in the csv containing the labels
9
label_column_name: str
10
11
# Column header in the csv containing the input text
12
text_column_name: str
13
14
# Name of dataset
15
name: str
16
17
# Description of dataset
18
description: str
Copied!

Raises

UnboxException
If the file doesn't exist, or the label or text column names are not in the dataset.

Returns

Dataset
Returns uploaded dataset

add_dataset

1
def add_dataset(self,
2
file_path: str,
3
class_names: List[str],
4
label_column_name: str,
5
text_column_name: str,
6
name: str,
7
description: str = None)> Dataset
Copied!
Uploads a dataset from a csv.

Args

1
# Path to the dataset csv
2
file_path: str
3
4
# List of class names indexed by label integer in the dataset
5
# ex. [negative, positive] when [0, 1] are labels in the csv
6
class_names: List[str]
7
8
# Column header in the csv containing the labels
9
label_column_name: str
10
11
# Column header in the csv containing the input text
12
text_column_name: str
13
14
# Name of dataset
15
name: str
16
17
# Description of dataset
18
description: str
Copied!

Raises

UnboxException
If the file doesn't exist or the label or text column names are not in the dataset

Returns

Dataset
Returns uploaded dataset

add_model

1
def add_model(self,
2
function,
3
model,
4
model_type: ModelType,
5
class_names: List[str],
6
name: str,
7
description: str = None)> Model
Copied!
Uploads a model.

Args

1
# Prediction function object in expected format
2
function
3
4
# Model object
5
model
6
7
# Model framework type of model
8
# ex. ModelType.sklearn
9
model_type: ModelType
10
11
# List of class names corresponding to outputs of predict function
12
class_names: List[str]
13
14
# Name of model
15
name: str
16
17
# Description of model
18
description: str
Copied!

Returns

Model
Returns uploaded model
Last modified 1mo ago