cancel
Showing results for 
Search instead for 
Did you mean: 

Create and run projects on different features using the API

dalilaB
DataRobot Alumni

Create and run projects on different features using the API

Recently, I posted a tip for creating and running projects on different features from the UI. This is really useful if, for example, you want to keep your dataset intact while also building models from just a subset of its features.

In this tip, I explain how you can do this also from the Python or R API. (See API documentation home for help using the DataRobot API.)

Using Python

  1. Upload the full dataset to DataRobot, and create a project for this dataset
    pandas_dataset = dr.Dataset.create_from_in_memory_data(data_frame=df)
    project = pandas_dataset.create_project(project_name = "Project_Name")
  2. Decide what features you want to include in your new feature list. For instance, I decided to create a feature list from the first 5 features from my original dataset and name it “Cleaned.”

    feature_list = list(df.columns)[0:5]
  3. Upload the new feature list (“Cleaned,” in this example) to your project.

    cleaned_ft = project.create_featurelist("Cleaned",feature_list)
  4. Start a new project with your new feature list.
    project.set_target(target= target_name,mode = 
         dr.enums.AUTOPILOT_MODE.FULL_AUTO, featurelist_id=cleaned_ft.id, 
         #You need the feature list id here
         autopilot_with_feature_discovery= True,
         max_wait=10000,
         worker_count = -1)​​

Using R

  1. Set up the project.
    project <- SetupProject(df, projectName = “Project_Name”, maxWait = 60 * 60)
  2. Choose the features you want to include in your new feature list.
    Features2keep <- names(df)[1:5]
  3. Upload your new feature list to the project
    featureList <- CreateFeaturelist(project,”Feature_List_Name”, feature2keep)
  4. Set the target and start building models with the new feature list.
    SetTarget(project = project,target= “TargetName”, featurelistId = featureList$featurelistId)

I hope you find this tip helpful. Please Kudo or add a comment to let me know. thanks! Dalila @dalilaB 

Labels (2)
0 Replies