It might be faster to do 
``` python
sample_weight = np.empty(X.shape[0], dtype=float)
sample_weight[:] = 1. / X.shape[0]
```