示例#1
0
def score(X: str, y: str) -> float:
    """
    Return the coefficient of determination R^2 of the prediction.


    :param X: Test samples. For some estimators this may be a
                    precomputed kernel matrix or a list of generic objects instead,
                    shape = (n_samples, n_samples_fitted),
                    where n_samples_fitted is the number of
                    samples used in the fitting for the estimator.
    :type X: array
    :param y: True values for X.
    :type y: array
    :param sample_weight: Sample weights.
    :type sample_weight: array
    :param return: R^2 of self.predict(X) wrt. y.
    :type return: float
    
    """

    X_input = "~/.cloudmesh/upload-file/" + f"{X}" + ".csv"
    y_input = "~/.cloudmesh/upload-file/" + f"{y}" + ".csv"
    X = pd.read_csv(X_input)
    y = pd.read_csv(y_input)
    model = ResultCache().load("Linregnew")
    float = model.score(X, y)

    return float
def score(X: array, y: array, sample_weight: array) -> float:
    """
    Return the mean accuracy on the given test data and labels.


    :param X: Test samples.
    :type X: array
    :param y: True labels for X.
    :type y: array
    :param sample_weight: Sample weights.
    :type sample_weight: array
    :param return: Mean accuracy of self.predict(X) wrt. y.
    :type return: float
    
    """

    model = ResultCache().load("RidgeClassifier")
    float = model.score(X, y, sample_weight)

    return float
示例#3
0
def score(X: array, y: array, sample_weight: array) -> float:
    """
    Return the coefficient of determination R^2 of the prediction.


    :param X: Test samples. For some estimators this may be a
                    precomputed kernel matrix or a list of generic objects instead,
                    shape = (n_samples, n_samples_fitted),
                    where n_samples_fitted is the number of
                    samples used in the fitting for the estimator.
    :type X: array
    :param y: True values for X.
    :type y: array
    :param sample_weight: Sample weights.
    :type sample_weight: array
    :param return: R^2 of self.predict(X) wrt. y.
    :type return: float
    
    """

    model = ResultCache().load("RidgeCV")
    float = model.score(X, y, sample_weight)

    return float