Class AI

  • All Implemented Interfaces:
    INeedClient, java.io.Serializable

    public class AI
    extends java.lang.Object
    implements java.io.Serializable, INeedClient
    A container for multiple learning sessions, dataset, and other entities in DataRobot AI. An AI groups together different entities necessary to solve a business problem, rather than being strictly focused on delivering a single model without any additional context.

    Note that this object is also a reference to a AI on the DataRobot server. Client code that uses the DataRobot AI API package generally should not construct these objects directly, they should be instantiated by AI API Client methods. This object may be out of sync with the DataRobot sever, for example, if multiple processes or users have permission to modify or delete it on the server.

    See Also:
    Serialized Form
    • Constructor Detail

      • AI

        public AI()
    • Method Detail

      • getOutputListUrl

        public java.lang.String getOutputListUrl()
        Get a URL for the list of Output objects associated with this AI
        Returns:
        URL location of the output list associated with this AI
      • getDatasetUrl

        public java.lang.String getDatasetUrl()
        Get a URL for the list of Dataset objects associated with this AI
        Returns:
        URL location of the dataset list associated with this AI
      • getLearningSessionUrlList

        public java.lang.String getLearningSessionUrlList()
        Get a URL for the list of LearningSession objects associated with this AI
        Returns:
        URL location of the learning session list associated with this AI
      • getName

        public java.lang.String getName()
        Get the name of this AI
        Returns:
        The name of this AI
      • getOutputCount

        public int getOutputCount()
        Get the number of Output objects associated with this AI
        Returns:
        The number of AI outputs
      • getDatasetCount

        public int getDatasetCount()
        Get the number of Dataset objects associated with this AI
        Returns:
        The number of AI datasets
      • getLearningSessionCount

        public int getLearningSessionCount()
        Get the number of LearningSession objects associated with this AI
        Returns:
        The number of AI learning sessions
      • getId

        public java.lang.String getId()
        Get the unique identifier for this AI
        Returns:
        The ID of this AI
      • getCreatedDate

        public org.joda.time.DateTime getCreatedDate()
        Get the date this AI was created
        Returns:
        The creation date of this AI
      • setOutputListUrl

        public void setOutputListUrl​(java.lang.String outputListUrl)
        internal
      • setDatasetListUrl

        public void setDatasetListUrl​(java.lang.String datasetListUrl)
        internal
      • setLearningSessionListUrl

        public void setLearningSessionListUrl​(java.lang.String learningSessionListUrl)
        internal
      • setName

        public void setName​(java.lang.String name)
        internal
      • setOutputCount

        public void setOutputCount​(int outputCount)
        internal
      • setDatasetCount

        public void setDatasetCount​(int datasetCount)
        internal
      • setLearningSessionCount

        public void setLearningSessionCount​(int learningSessionCount)
        internal
      • setId

        public void setId​(java.lang.String id)
        internal
      • importFile

        public Dataset importFile​(java.lang.String filepath)
                           throws java.io.FileNotFoundException,
                                  ClientException,
                                  java.lang.InterruptedException
        Import a file to an AI. See the Dataset page in the documentation for size limitations.
        Parameters:
        filepath - The path of a local file to upload
        Returns:
        Dataset
        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.
        java.lang.InterruptedException - when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity.
      • importUrl

        public Dataset importUrl​(java.lang.String url)
                          throws ClientException,
                                 java.lang.InterruptedException
        Import a file to an AI via a public URL. See the Dataset page in the documentation for size limitations.
        Parameters:
        url - The url to a publically available file
        Returns:
        Dataset
        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.
      • addDataset

        public void addDataset​(Dataset dataset)
                        throws ClientException
        Add a Dataset to this AI
        Parameters:
        dataset - The dataset which to add
        Throws:
        ClientException - when 4xx or 5xx response is received from server, or errors in parsing the response.
      • learn

        public AI learn​(java.lang.String target,
                        java.lang.String sourcefile)
                 throws ClientException,
                        java.lang.InterruptedException,
                        java.io.FileNotFoundException
        Create a LearningSession directly associated to this AI
        Parameters:
        target - The name of the selected target feature to learn
        sourcefile - The data on which to learn via a path to a local file
        Returns:
        The AI this learning session was created with
        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.
        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.
      • predict

        public PredictionList predict​(java.lang.String target,
                                      java.lang.String sourceFile)
                               throws java.io.FileNotFoundException,
                                      ClientException
        Retrieve AI predictions
        Parameters:
        target - The name of the selected target feature to predict
        sourceFile - The data on which to make predictions via a path to a local file
        Returns:
        PredictionList
        Throws:
        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.
        ClientException - when 4xx or 5xx response is received from server, or errors in parsing the response.
      • infer

        public PredictionList infer​(java.lang.String target,
                                    java.lang.String sourceFile)
                             throws java.io.FileNotFoundException,
                                    ClientException
        Retrieve ai predictions
        Parameters:
        target - The name of the selected target feature to predict
        sourceFile - The data on which to make predictions via a path to a local file
        Returns:
        PredictionList
        Throws:
        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.
        ClientException - when 4xx or 5xx response is received from server, or errors in parsing the response.
      • getOutput

        public Output getOutput​(java.lang.String outputTarget)
                         throws ClientException
        Retrieve an Output for this AI
        Parameters:
        outputTarget - The target of the output
        Returns:
        Output
        Throws:
        ClientException - when 4xx or 5xx response is received from server, or errors in parsing the response.
      • addOutput

        public void addOutput​(java.lang.String learningSessionId,
                              java.lang.String outputName)
                       throws ClientException
        Add a Output to this LearningSession
        Parameters:
        learningSessionId - The ID of the learning session this output is connected to
        outputName - The name of the output to add
        Throws:
        ClientException - when 4xx or 5xx response is received from server, or errors in parsing the response.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object