aglinxinyuan commented on code in PR #6048:
URL: https://github.com/apache/texera/pull/6048#discussion_r3510082294
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/sklearn/training/SklearnTrainingOpDesc.scala:
##########
@@ -19,73 +19,16 @@
package org.apache.texera.amber.operator.sklearn.training
-import com.fasterxml.jackson.annotation.{JsonIgnore, JsonProperty,
JsonPropertyDescription}
-import com.kjetland.jackson.jsonSchema.annotations.{
- JsonSchemaInject,
- JsonSchemaInt,
- JsonSchemaString,
- JsonSchemaTitle
-}
-import org.apache.texera.amber.core.tuple.{AttributeType, Schema}
import
org.apache.texera.amber.pybuilder.PythonTemplateBuilder.PythonTemplateBuilderStringContext
-import org.apache.texera.amber.pybuilder.PyStringTypes.EncodableString
import org.apache.texera.amber.core.workflow.{InputPort, OutputPort,
PortIdentity}
-import org.apache.texera.amber.operator.PythonOperatorDescriptor
-import org.apache.texera.amber.operator.metadata.annotations.{
- AutofillAttributeName,
- CommonOpDescAnnotation,
- HideAnnotation
-}
import org.apache.texera.amber.operator.metadata.{OperatorGroupConstants,
OperatorInfo}
+import org.apache.texera.amber.operator.sklearn.SklearnModelOpDesc
-class SklearnTrainingOpDesc extends PythonOperatorDescriptor {
-
- @JsonSchemaTitle("Target Attribute")
- @JsonPropertyDescription("Attribute in your dataset corresponding to
target.")
- @JsonProperty(required = true)
- @AutofillAttributeName
- var target: EncodableString = _
-
- @JsonSchemaTitle("Count Vectorizer")
- @JsonPropertyDescription("Convert a collection of text documents to a matrix
of token counts.")
- @JsonProperty(defaultValue = "false")
- var countVectorizer: Boolean = false
-
- @JsonSchemaTitle("Text Attribute")
- @JsonPropertyDescription("Attribute in your dataset with text to vectorize.")
- @JsonSchemaInject(
- strings = Array(
- new JsonSchemaString(
- path = CommonOpDescAnnotation.autofill,
- value = CommonOpDescAnnotation.attributeName
- ),
- new JsonSchemaString(path = HideAnnotation.hideTarget, value =
"countVectorizer"),
- new JsonSchemaString(path = HideAnnotation.hideType, value =
HideAnnotation.Type.equals),
- new JsonSchemaString(path = HideAnnotation.hideExpectedValue, value =
"false")
- ),
- ints = Array(
- new JsonSchemaInt(path = CommonOpDescAnnotation.autofillAttributeOnPort,
value = 0)
- )
- )
- var text: EncodableString = _
-
- @JsonSchemaTitle("Tfidf Transformer")
- @JsonPropertyDescription("Transform a count matrix to a normalized tf or
tf-idf representation.")
- @JsonProperty(defaultValue = "false")
- @JsonSchemaInject(
- strings = Array(
- new JsonSchemaString(path = HideAnnotation.hideTarget, value =
"countVectorizer"),
- new JsonSchemaString(path = HideAnnotation.hideType, value =
HideAnnotation.Type.equals),
- new JsonSchemaString(path = HideAnnotation.hideExpectedValue, value =
"false")
- )
- )
- var tfidfTransformer: Boolean = false
+class SklearnTrainingOpDesc extends SklearnModelOpDesc {
- @JsonIgnore
- def getImportStatements = "from sklearn.ensemble import
RandomForestClassifier"
+ override def getImportStatements = "from sklearn.ensemble import
RandomForestClassifier"
Review Comment:
This string should be empty since it gets overridden anyway. The placeholder
was introduced by mistake in the first place.
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/sklearn/training/SklearnTrainingOpDesc.scala:
##########
@@ -19,73 +19,16 @@
package org.apache.texera.amber.operator.sklearn.training
-import com.fasterxml.jackson.annotation.{JsonIgnore, JsonProperty,
JsonPropertyDescription}
-import com.kjetland.jackson.jsonSchema.annotations.{
- JsonSchemaInject,
- JsonSchemaInt,
- JsonSchemaString,
- JsonSchemaTitle
-}
-import org.apache.texera.amber.core.tuple.{AttributeType, Schema}
import
org.apache.texera.amber.pybuilder.PythonTemplateBuilder.PythonTemplateBuilderStringContext
-import org.apache.texera.amber.pybuilder.PyStringTypes.EncodableString
import org.apache.texera.amber.core.workflow.{InputPort, OutputPort,
PortIdentity}
-import org.apache.texera.amber.operator.PythonOperatorDescriptor
-import org.apache.texera.amber.operator.metadata.annotations.{
- AutofillAttributeName,
- CommonOpDescAnnotation,
- HideAnnotation
-}
import org.apache.texera.amber.operator.metadata.{OperatorGroupConstants,
OperatorInfo}
+import org.apache.texera.amber.operator.sklearn.SklearnModelOpDesc
-class SklearnTrainingOpDesc extends PythonOperatorDescriptor {
-
- @JsonSchemaTitle("Target Attribute")
- @JsonPropertyDescription("Attribute in your dataset corresponding to
target.")
- @JsonProperty(required = true)
- @AutofillAttributeName
- var target: EncodableString = _
-
- @JsonSchemaTitle("Count Vectorizer")
- @JsonPropertyDescription("Convert a collection of text documents to a matrix
of token counts.")
- @JsonProperty(defaultValue = "false")
- var countVectorizer: Boolean = false
-
- @JsonSchemaTitle("Text Attribute")
- @JsonPropertyDescription("Attribute in your dataset with text to vectorize.")
- @JsonSchemaInject(
- strings = Array(
- new JsonSchemaString(
- path = CommonOpDescAnnotation.autofill,
- value = CommonOpDescAnnotation.attributeName
- ),
- new JsonSchemaString(path = HideAnnotation.hideTarget, value =
"countVectorizer"),
- new JsonSchemaString(path = HideAnnotation.hideType, value =
HideAnnotation.Type.equals),
- new JsonSchemaString(path = HideAnnotation.hideExpectedValue, value =
"false")
- ),
- ints = Array(
- new JsonSchemaInt(path = CommonOpDescAnnotation.autofillAttributeOnPort,
value = 0)
- )
- )
- var text: EncodableString = _
-
- @JsonSchemaTitle("Tfidf Transformer")
- @JsonPropertyDescription("Transform a count matrix to a normalized tf or
tf-idf representation.")
- @JsonProperty(defaultValue = "false")
- @JsonSchemaInject(
- strings = Array(
- new JsonSchemaString(path = HideAnnotation.hideTarget, value =
"countVectorizer"),
- new JsonSchemaString(path = HideAnnotation.hideType, value =
HideAnnotation.Type.equals),
- new JsonSchemaString(path = HideAnnotation.hideExpectedValue, value =
"false")
- )
- )
- var tfidfTransformer: Boolean = false
+class SklearnTrainingOpDesc extends SklearnModelOpDesc {
- @JsonIgnore
- def getImportStatements = "from sklearn.ensemble import
RandomForestClassifier"
+ override def getImportStatements = "from sklearn.ensemble import
RandomForestClassifier"
- @JsonIgnore
- def getUserFriendlyModelName = "RandomForest Training"
+ override def getUserFriendlyModelName = "RandomForest Training"
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]