Last active
May 21, 2018 21:00
-
-
Save hamelsmu/efc783cf845e76f8735a3ac9af5dad23 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def cleanup_virtualenv(bare=True): | |
if not bare: | |
click.echo(crayons.red('Environment creation aborted.')) | |
try: | |
# Delete the virtualenv. | |
rmtree(project.virtualenv_location) | |
except OSError as e: | |
click.echo( | |
'{0} An error occurred while removing {1}!'.format( | |
crayons.red('Error: ', bold=True), | |
crayons.green(project.virtualenv_location), | |
), | |
err=True, | |
) | |
click.echo(crayons.blue(e), err=True) | |
def mean_squared_error(y_true, y_pred, | |
sample_weight=None, | |
multioutput='uniform_average'): | |
y_type, y_true, y_pred, multioutput = _check_reg_targets( | |
y_true, y_pred, multioutput) | |
check_consistent_length(y_true, y_pred, sample_weight) | |
output_errors = np.average((y_true - y_pred) ** 2, axis=0, | |
weights=sample_weight) | |
if isinstance(multioutput, string_types): | |
if multioutput == 'raw_values': | |
return output_errors | |
elif multioutput == 'uniform_average': | |
# pass None as weights to np.average: uniform mean | |
multioutput = None | |
return np.average(output_errors, weights=multioutput) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment