Skip to content

Commit a54a360

Browse files
committed
set project function and prediction var
1 parent 94728a4 commit a54a360

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

src/sasctl/tasks.py

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -270,38 +270,27 @@ def get_version(x):
270270
vars = model.get('inputVariables', [])[:]
271271
vars += model.get('outputVariables', [])
272272

273-
# Project Functions:
274-
# Analytical
275-
# Classification
276-
# Clustering
277-
# Forecasting
278-
# Prediction
279-
# Text Analytics
280-
# Transformation
281-
282-
# Target Levels:
283-
# Binary
284-
# Nominal
285-
# Ordinal
286-
# Interval
287-
288-
# project = mr.get_project(model.projectId)
289-
# # Update project properties
290-
# project['function'] = 'prediction'
291-
# project['targetLevel'] = 'interval'
292-
# project['targetVariable'] = 'Price'
293-
# project['predictionVariable'] = 'var1'
294-
# project = mr.update_project(project)
295-
296-
297-
if model.get('function') == 'Regression':
273+
function = model.get('function', '').lower()
274+
algorithm = model.get('algorithm', '').lower()
275+
276+
if function == 'classification' and 'logistic' in algorithm:
277+
target_level = 'Binary'
278+
elif function == 'prediction' and 'regression' in algorithm:
298279
target_level = 'Interval'
299280
else:
300281
target_level = None
301282

283+
if len(model.get('outputVariables', [])) == 1:
284+
var = model['outputVariables'][0]
285+
prediction_variable = var['name']
286+
else:
287+
prediction_variable = None
288+
302289
project = mr.create_project(project, repo_obj,
303290
variables=vars,
304-
targetLevel=target_level)
291+
function=model.get('function'),
292+
targetLevel=target_level,
293+
predictionVariable=prediction_variable)
305294

306295
model = mr.create_model(model, project)
307296

0 commit comments

Comments
 (0)