Home | Trees | Indices | Help |
---|
|
Created on Thu Feb 8 09:22:00 2013
Copyright (c) 2013-2014, CEA/DSV/I2BM/Neurospin. All rights reserved.
Author: Tommy Löfstedt and Edouard Duchesnay
License: BSD 3-clause.
|
|||
|
|
|||
AnonymousClass Used to create anonymous classes. |
|
|||
floating point number |
|
||
floating point number |
|
||
floating point number |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
__package__ =
|
|
Return the CPU time or real time since the start of the process or since the first call to clock(). This has as much precision as the system records.
|
Return the current time in seconds since the Epoch. Fractions of a second may be present if the system clock provides them.
|
Return the CPU time or real time since the start of the process or since the first call to clock(). This has as much precision as the system records.
|
This decorator can be used to mark functions as deprecated. Useful when phasing out old API functions. Parameters ---------- replaced_by : String. The name of the function that should be used instead. |
Checks that: - Lists are converted to numpy arrays. - All arrays are cast to float. - All arrays have consistent first dimensions. - Arrays are at least 2D arrays, if not they are reshaped. Parameters ---------- *arrays: Sequence of arrays or scipy.sparse matrices with same shape[0] Python lists or tuples occurring in arrays are converted to 2D numpy arrays. Examples -------- >>> import numpy as np >>> check_arrays([1, 2], np.array([3, 4]), np.array([[1., 2.], [3., 4.]])) [array([[ 1.], [ 2.]]), array([[ 3.], [ 4.]]), array([[ 1., 2.], [ 3., 4.]])] |
Estimate class weights for unbalanced datasets. Parameters ---------- class_weight : dict, 'auto' or None If 'auto', class weights will be given inverse proportional to the frequency of the class in the data. sample_weight will sum to n_sample. If a dictionary is given, keys are classes and values are corresponding class weights. With two classes in {1, 0}, class_weight = {0:0.5, 1:0.5} is equivalent to class_weight == "auto" If None is given, the class weights will be uniform sample_weight==1. y : array-like, shape (n_samples,) Array of original class labels per sample; Returns ------- weight_vect : ndarray, shape (n_samples,) Array with weight_vect[i] the weight for i-th sample Example ------- >>> y = [1, 1, 1, 0, 0, 2] >>> w = class_weight_to_sample_weight("auto", y) >>> print w.sum() == len(y) True >>> print ["%i:%.2f" % (l, np.sum(w[y==l])) for l in np.unique(y)] ['0:2.00', '1:2.00', '2:2.00'] >>> y = [1, 1, 1, 0, 0, 2] >>> w2 = class_weight_to_sample_weight({0:1./3, 1:1./3, 2:1./3}, y) >>> np.all(w2 == w) True |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Apr 6 23:52:10 2015 | http://epydoc.sourceforge.net |