Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def validate(sk_node):
try:
utils._check_has_attr(sk_node, 'tree_')
utils._check_has_attr(sk_node, 'classes_')
except AttributeError as e:
raise RuntimeError('Missing attribute in sklearn model ' + str(e))
def validate(sk_node):
try:
utils._check_has_attr(sk_node, 'scale_')
utils._check_has_attr(sk_node, 'mean_')
except AttributeError as e:
raise RuntimeError("Missing type from sklearn node:" + str(e))
# Scikit converts zeroes in scale explicitly so all components should have non-zero values.
if (sk_node.scale_ == 0).any():
raise RuntimeError("The scale cannot contain any zero")
def validate(cm_node):
try:
utils._check_has_attr(cm_node, 'supportVectorClassifier')
utils._check_has_attr(cm_node.supportVectorClassifier, 'kernel')
utils._check_has_attr(cm_node.supportVectorClassifier, 'numberOfSupportVectorsPerClass')
utils._check_has_attr(cm_node.supportVectorClassifier, 'coefficients')
utils._check_has_attr(cm_node.supportVectorClassifier.coefficients[0], 'alpha')
utils._check_has_attr(cm_node.supportVectorClassifier, 'rho')
except AttributeError as e:
raise RuntimeError("Missing type from CoreML node:" + str(e))
def validate(sk_node):
try:
utils._check_has_attr(sk_node, 'support_vectors_')
utils._check_has_attr(sk_node, 'coef0')
utils._check_has_attr(sk_node, '_gamma')
utils._check_has_attr(sk_node, 'degree')
utils._check_has_attr(sk_node, 'intercept_')
except AttributeError as e:
raise RuntimeError("Missing type from sklearn node:" + str(e))
def validate(cm_node):
try:
utils._check_has_attr(cm_node, 'supportVectorRegressor')
utils._check_has_attr(cm_node.supportVectorRegressor, 'kernel')
utils._check_has_attr(cm_node.supportVectorRegressor, 'coefficients')
utils._check_has_attr(cm_node.supportVectorRegressor.coefficients, 'alpha')
utils._check_has_attr(cm_node.supportVectorRegressor, 'rho')
except AttributeError as e:
raise RuntimeError("Missing type from CoreML node:" + str(e))
def validate(sk_node):
try:
utils._check_has_attr(sk_node, 'feature_names_')
except AttributeError as e:
raise RuntimeError("Missing type from sklearn node:" + str(e))
def validate(cm_node):
try:
utils._check_has_attr(cm_node, 'biDirectionalLSTM')
utils._check_has_attr(cm_node, 'input')
utils._check_has_attr(cm_node, 'output')
except AttributeError as e:
raise RuntimeError('Missing attribute in neural network layer: {0}'.format(cm_node.name))
def validate(cm_node):
try:
utils._check_has_attr(cm_node, 'dictVectorizer')
except AttributeError as e:
raise RuntimeError('Missing type from CoreML node:' + str(e))
def validate(cm_node):
try:
utils._check_has_attr(cm_node, 'normalizer')
except AttributeError as e:
raise RuntimeError('Missing type from CoreML node:' + str(e))