Skip to main content

Guides

Importing Data and Models

If you are not in a competition, and just want to test AG, you can use the private_import feature to load models or datasets directly into the AG server for your personal computations.

Importing a Dataframe

To import a standard dataframe into the AG server, use the private_import function. The code block below presents an example of how to import a dataframe named “df”:

# Assuming you have a Pandas DataFrame named 'df'
session.private_import(name='df', data=dataframe)
session_object

The session object in AG is created by logging into AG’s environment.

name parameter

The name parameter serves as an identifier for your imported data or model.

When executed, the dataframe will be cached to the server and loaded into the kernel. The following confirmation will be displayed:

dataframe cached to server, loading to kernel...
Output: Dataframe loaded successfully to the kernel

Since this is a standard dataframe, you can convert it into a PrivateDataFrame the following way:

%%ag
from op_pandas import PrivateDataFrame
pdf = PrivateDataFrame(df)

Importing an ONNX Model

You can use the private_import function to import ONNX models. The code block below presents two examples of importing models from variables or providing the model path:

# To import an ONNX model from a variable
private_import(name='model', data=onnx_model)

# To import an ONNX model from a local path
private_import(name='model', path='local/path_to_model')

Once you import the model, the terminal will present the following confirmation:

model cached to server, loading to kernel...
Output: Model loaded successfully to the kernel