'Set the sample weight array.'

def _validate_sample_weight(self, sample_weight, n_samples):

    if (sample_weight is None):
        sample_weight = np.ones(n_samples, dtype=np.float64, order='C')
    else:
        sample_weight = np.asarray(sample_weight, dtype=np.float64, order='C')
    if (sample_weight.shape[0] != n_samples):
        raise ValueError('Shapes    of    X    and    sample_weight    do    not    match.')
    return sample_weight
