cancel
Showing results for 
Search instead for 
Did you mean: 

Clone project and run autopilot with specific feature list

GiorgioC
NiCd Battery

Clone project and run autopilot with specific feature list

Hi all,

 

How can I clone a project and run autopilot on a specific feature list? I tried the code below but it give me an error. Without a specific feature list the loop runs ok. 

 

Thank you,

Giorgio

@christian 

 

project = dr.Project.get('XXXXXXXXXXXXXXXXXX')
featurelist = project.create_featurelist("Fire_top_10")
featurelist_id = featurelist.id

 

for x in range(6):
partitioning = dr.StratifiedCV(holdout_pct = 20, reps = 10, seed = x)
new_project = project.clone_project(new_project_name='Project_cloned_'+str(x))
new_project.set_target(target="response_status", mode='quick', featurelist_id = featurelist_name.id, partitioning_method = partitioning, worker_count = -1)

 

 

 

Labels (1)
0 Kudos
2 Replies
christian
Data Scientist
Data Scientist

Hi Giorgio

In the example shown the feature list id must belong to the new_project rather than the project it was cloned from. To do this you can insert the code below after the second last line in order to retrieve the cloned feature list. Then you iterate over the list of feature lists to find the one with the name you want.

 

flists = new_project.get_featurelists()
featurelist = next(flist for flist in flists if flist.name == "Fire_top_10")

 

Then you can use the following in the last line of your code

 

featurelist_id = featurelist.id

 

 

 

GiorgioC
NiCd Battery

Hi @christian,

 

Thanks for the tip. I tested it and it works:

 

project = dr.Project.get('Your_project_ID')

for x in range(6):
partitioning = dr.StratifiedCV(holdout_pct = 20, reps = 10, seed = x)
new_project = project.clone_project(new_project_name='test'+str(x))
flists = new_project.get_featurelists()
featurelist = next(flist for flist in flists if flist.name == "Specific_feature_list_from_cloning_project")
new_project.set_target(target="Target", mode='quick', featurelist_id = featurelist.id, partitioning_method = partitioning, worker_count = -1)

0 Kudos