-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(discov2): update models and add new methods
NEW methods: listDocuments, getDocument, listDocumentClassifiers, createDocumentClassifier, getDocumentClassifier, updateDocumentClassifier, deleteDocumentClassifier, listDocumentClassifierModels, createDocumentClassifierModels, getDocumentClassifierModels, updateDocumentClassifierModels, deleteDocumentClassifierModels, getStopwordList, createStopwordList, deleteStopwordList, listExpansions, createExpansions, deleteExpansions
- Loading branch information
1 parent
4f4894f
commit a29cb73
Showing
45 changed files
with
6,718 additions
and
327 deletions.
There are no files selected for viewing
1,382 changes: 1,088 additions & 294 deletions
1,382
discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java
Large diffs are not rendered by default.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
discovery/src/main/java/com/ibm/watson/discovery/v2/model/ClassifierFederatedModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* (C) Copyright IBM Corp. 2022. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
package com.ibm.watson.discovery.v2.model; | ||
|
||
import com.ibm.cloud.sdk.core.service.model.GenericModel; | ||
|
||
/** An object with details for creating federated document classifier models. */ | ||
public class ClassifierFederatedModel extends GenericModel { | ||
|
||
protected String field; | ||
|
||
/** Builder. */ | ||
public static class Builder { | ||
private String field; | ||
|
||
private Builder(ClassifierFederatedModel classifierFederatedModel) { | ||
this.field = classifierFederatedModel.field; | ||
} | ||
|
||
/** Instantiates a new builder. */ | ||
public Builder() {} | ||
|
||
/** | ||
* Instantiates a new builder with required properties. | ||
* | ||
* @param field the field | ||
*/ | ||
public Builder(String field) { | ||
this.field = field; | ||
} | ||
|
||
/** | ||
* Builds a ClassifierFederatedModel. | ||
* | ||
* @return the new ClassifierFederatedModel instance | ||
*/ | ||
public ClassifierFederatedModel build() { | ||
return new ClassifierFederatedModel(this); | ||
} | ||
|
||
/** | ||
* Set the field. | ||
* | ||
* @param field the field | ||
* @return the ClassifierFederatedModel builder | ||
*/ | ||
public Builder field(String field) { | ||
this.field = field; | ||
return this; | ||
} | ||
} | ||
|
||
protected ClassifierFederatedModel() {} | ||
|
||
protected ClassifierFederatedModel(Builder builder) { | ||
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.field, "field cannot be null"); | ||
field = builder.field; | ||
} | ||
|
||
/** | ||
* New builder. | ||
* | ||
* @return a ClassifierFederatedModel builder | ||
*/ | ||
public Builder newBuilder() { | ||
return new Builder(this); | ||
} | ||
|
||
/** | ||
* Gets the field. | ||
* | ||
* <p>Name of the field that contains the values from which multiple classifier models are | ||
* defined. For example, you can specify a field that lists product lines to create a separate | ||
* model per product line. | ||
* | ||
* @return the field | ||
*/ | ||
public String field() { | ||
return field; | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
discovery/src/main/java/com/ibm/watson/discovery/v2/model/ClassifierModelEvaluation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* (C) Copyright IBM Corp. 2022. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
package com.ibm.watson.discovery.v2.model; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import com.ibm.cloud.sdk.core.service.model.GenericModel; | ||
import java.util.List; | ||
|
||
/** An object that contains information about a trained document classifier model. */ | ||
public class ClassifierModelEvaluation extends GenericModel { | ||
|
||
@SerializedName("micro_average") | ||
protected ModelEvaluationMicroAverage microAverage; | ||
|
||
@SerializedName("macro_average") | ||
protected ModelEvaluationMacroAverage macroAverage; | ||
|
||
@SerializedName("per_class") | ||
protected List<PerClassModelEvaluation> perClass; | ||
|
||
/** | ||
* Gets the microAverage. | ||
* | ||
* <p>A micro-average aggregates the contributions of all classes to compute the average metric. | ||
* Classes refers to the classification labels that are specified in the **answer_field**. | ||
* | ||
* @return the microAverage | ||
*/ | ||
public ModelEvaluationMicroAverage getMicroAverage() { | ||
return microAverage; | ||
} | ||
|
||
/** | ||
* Gets the macroAverage. | ||
* | ||
* <p>A macro-average computes metric independently for each class and then takes the average. | ||
* Class refers to the classification label that is specified in the **answer_field**. | ||
* | ||
* @return the macroAverage | ||
*/ | ||
public ModelEvaluationMacroAverage getMacroAverage() { | ||
return macroAverage; | ||
} | ||
|
||
/** | ||
* Gets the perClass. | ||
* | ||
* <p>An array of evaluation metrics, one set of metrics for each class, where class refers to the | ||
* classification label that is specified in the **answer_field**. | ||
* | ||
* @return the perClass | ||
*/ | ||
public List<PerClassModelEvaluation> getPerClass() { | ||
return perClass; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.