Package com.datarobot.impl
Class AIClient
- java.lang.Object
-
- com.datarobot.impl.AIClient
-
- All Implemented Interfaces:
IAIClient,IDoGetCallback<AI>
public class AIClient extends java.lang.Object implements IAIClient, IDoGetCallback<AI>
TheAIClientobject provides access to the AI endpoints of the DataRobot AI API. This object is not meant to be used directly but through theDataRobotAIClient.ais()method.
-
-
Constructor Summary
Constructors Constructor Description AIClient(IDataRobotAIClient client)IAIClientbased API operations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDataset(java.lang.String aiId, java.lang.String datasetId)Add aDatasetto the AIvoidaddLearningSession(java.lang.String aiId, java.lang.String learningSessionId, java.lang.String outputName)Add aLearningSessionto the AIvoidaddOutput(java.lang.String aiId, java.lang.String learningSessionId, java.lang.String outputName)Add anOutputto the AIAIcreateAI(java.lang.String name)Create an AI with the given namevoiddelete(java.lang.String aiId)Delete an AIAIget(java.lang.String id)Retrieve an AIAction<com.google.api.client.http.HttpRequest,com.google.api.client.http.HttpResponse>getHttpMessageTransformer()internalLearningSessionListgetLearningSessions(java.lang.String aiId)Retrieve a list of all learning sessions associated with an AILearningSessionListgetLearningSessions(java.lang.String aiId, PagingParams params)Retrieve a list of all learning sessions associated with an AIOutputgetOutput(java.lang.String aiId, java.lang.String outputTarget)Retrieve theOutputassociated with an AI and targetOutputFeaturesgetOutputFeatures(java.lang.String aiId, java.lang.String outputName)Retrieve features of an output associated with an AI and a targetOutputListgetOutputs(java.lang.String aiId)Retrieve a list of all outputs associated with an AI.OutputListgetOutputs(java.lang.String aiId, PagingParams params)Retrieve a list of all outputs associated with an AI.PredictionListinfer(java.lang.String aiId, java.lang.String target, java.lang.String filePath)Make predictions on an AI, target and dataset.AIListlist()Retrieve a list of all AIs associated with this accountAIListlist(PagingParams params)Retrieve a list of all AIs associated with this accountPredictionListpredict(java.lang.String aiId, java.lang.String target, java.lang.String filePath)Make predictions on an AI, target and dataset.voidsetHttpMessageTransformer(Action<com.google.api.client.http.HttpRequest,com.google.api.client.http.HttpResponse> httpMessageTransformer)internaljava.lang.StringtoString()
-
-
-
Constructor Detail
-
AIClient
public AIClient(IDataRobotAIClient client)
IAIClientbased API operations. Users will not need to instantiate this object directly. It can be accessed throughDataRobotAIClient.ais().- Parameters:
client-DataRobotAIClient
-
-
Method Detail
-
getHttpMessageTransformer
public Action<com.google.api.client.http.HttpRequest,com.google.api.client.http.HttpResponse> getHttpMessageTransformer()
internal- Specified by:
getHttpMessageTransformerin interfaceIAIClient
-
setHttpMessageTransformer
public void setHttpMessageTransformer(Action<com.google.api.client.http.HttpRequest,com.google.api.client.http.HttpResponse> httpMessageTransformer)
internal- Specified by:
setHttpMessageTransformerin interfaceIAIClient
-
get
public AI get(java.lang.String id) throws ClientException
Retrieve an AI- Specified by:
getin interfaceIAIClient- Specified by:
getin interfaceIDoGetCallback<AI>- Parameters:
id- The ID of the AI to retrieve- Returns:
- The queried
AI - Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
list
public AIList list() throws ClientException
Retrieve a list of all AIs associated with this account- Specified by:
listin interfaceIAIClient- Returns:
AIList- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
list
public AIList list(PagingParams params) throws ClientException
Retrieve a list of all AIs associated with this account- Specified by:
listin interfaceIAIClient- Parameters:
params- ThePagingParamsobject for this list- Returns:
AIList- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
createAI
public AI createAI(java.lang.String name) throws ClientException, java.lang.InterruptedException
Create an AI with the given name- Specified by:
createAIin interfaceIAIClient- Parameters:
name- The name of the AI- Returns:
- The new
AI - Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.java.lang.InterruptedException- when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity.
-
delete
public void delete(java.lang.String aiId) throws ClientExceptionDelete an AI- Specified by:
deletein interfaceIAIClient- Parameters:
aiId- The ID of the AI to delete- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
addLearningSession
public void addLearningSession(java.lang.String aiId, java.lang.String learningSessionId, java.lang.String outputName) throws ClientExceptionAdd aLearningSessionto the AI- Specified by:
addLearningSessionin interfaceIAIClient- Parameters:
aiId- The ID of the AI to which you want to add the learning sessionlearningSessionId- The ID of the learning session to addoutputName- Name of the output this AI will learn- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
addDataset
public void addDataset(java.lang.String aiId, java.lang.String datasetId) throws ClientExceptionAdd aDatasetto the AI- Specified by:
addDatasetin interfaceIAIClient- Parameters:
aiId- The ID of the AI to which you want to add the datasetdatasetId- The ID of the dataset to add- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
getLearningSessions
public LearningSessionList getLearningSessions(java.lang.String aiId) throws ClientException
Retrieve a list of all learning sessions associated with an AI- Specified by:
getLearningSessionsin interfaceIAIClient- Parameters:
aiId- The ID of the AI to retrieve learning sessions for- Returns:
LearningSessionList- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
getLearningSessions
public LearningSessionList getLearningSessions(java.lang.String aiId, PagingParams params) throws ClientException
Retrieve a list of all learning sessions associated with an AI- Specified by:
getLearningSessionsin interfaceIAIClient- Parameters:
aiId- The ID of the AI to retrieve learning sessions forparams- ThePagingParamsobject for this list- Returns:
LearningSessionList- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
getOutput
public Output getOutput(java.lang.String aiId, java.lang.String outputTarget) throws ClientException
Retrieve theOutputassociated with an AI and target- Specified by:
getOutputin interfaceIAIClient- Parameters:
aiId- The ID of the AI to retrieve an output foroutputTarget- The target of this output- Returns:
Output- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
predict
public PredictionList predict(java.lang.String aiId, java.lang.String target, java.lang.String filePath) throws ClientException, java.io.FileNotFoundException
Make predictions on an AI, target and dataset. Note an AI must be trained withAI.learn(java.lang.String, java.lang.String)or an existing learning session must be added to the AI withAI.addLearningSession(com.datarobot.model.LearningSession)orIAIClient.addLearningSession(java.lang.String, java.lang.String, java.lang.String)before predictions can occur.- Specified by:
predictin interfaceIAIClient- Parameters:
aiId- The ID of the AI to retrieve predictions fortarget- The name of the selected target feature to predict onfilePath- The data on which to predict via a filepath on the local system- Returns:
PredictionList- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.java.io.FileNotFoundException- when a file with the specified pathname does not exist, or if the file does exist but is inaccessible for some reason.
-
infer
public PredictionList infer(java.lang.String aiId, java.lang.String target, java.lang.String filePath) throws ClientException, java.io.FileNotFoundException
Make predictions on an AI, target and dataset. Note an AI must be trained withAI.learn(java.lang.String, java.lang.String)or an existing learning session must be added to the AI withAI.addLearningSession(com.datarobot.model.LearningSession)orIAIClient.addLearningSession(java.lang.String, java.lang.String, java.lang.String)before predictions can occur.- Specified by:
inferin interfaceIAIClient- Parameters:
aiId- The ID of the AI to retrieve predictions fortarget- The name of the selected target feature to predict onfilePath- The data on which to predict via a filepath on the local system- Returns:
PredictionList- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.java.io.FileNotFoundException- when a file with the specified pathname does not exist, or if the file does exist but is inaccessible for some reason.
-
getOutputs
public OutputList getOutputs(java.lang.String aiId) throws ClientException
Retrieve a list of all outputs associated with an AI.- Specified by:
getOutputsin interfaceIAIClient- Parameters:
aiId- The ID of the AI to retrieve outputs for- Returns:
OutputList- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
getOutputs
public OutputList getOutputs(java.lang.String aiId, PagingParams params) throws ClientException
Retrieve a list of all outputs associated with an AI.- Specified by:
getOutputsin interfaceIAIClient- Parameters:
aiId- The ID of the AI to retrieve outputs forparams- ThePagingParamsobject for this list- Returns:
OutputList- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
addOutput
public void addOutput(java.lang.String aiId, java.lang.String learningSessionId, java.lang.String outputName) throws ClientExceptionAdd anOutputto the AI- Specified by:
addOutputin interfaceIAIClient- Parameters:
aiId- The ID of the AI to which you want to add the datasetlearningSessionId- The ID of the learning sessionoutputName- The name of the output- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
getOutputFeatures
public OutputFeatures getOutputFeatures(java.lang.String aiId, java.lang.String outputName) throws ClientException
Retrieve features of an output associated with an AI and a target- Specified by:
getOutputFeaturesin interfaceIAIClient- Parameters:
aiId- The ID of the AI to retrieve output features foroutputName- The name of the output- Returns:
OutputFeatures- Throws:
ClientException- when 4xx or 5xx response is received from server, or errors in parsing the response.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-