src/jpyEDM_v0.py
def NewSolver( newSolver ):
    '''Instantiate sklearn solver based on solver and parameters'''
    global SMapSolver
    
    if not sklearnImported :
        solver = None
        dfOutput.clear_output()
        with dfOutput:
            display( print( "sklearn module not imported, using SVD solver." ) )
        return

    UpdateArgs()

    alpha = Widgets['alpha'].value # FloatText widget

    # Convert l1_ratio text string to float []
    l1_ratio = [ float(x) for x in Widgets['l1_ratio'].value.split() ]
    # JP: Elastic Net Kludge since alpha is scalar.
    #     alpha and l1_ratio need to be same dimension, we have alpha scalar
    #     Need to generalize alpha to Text/vector?
    if len( l1_ratio ) == 1 :
        l1_ratio = l1_ratio[0]

    if 'SVD' in newSolver :
        SMapSolver = None
    elif 'Ridge CV' in newSolver :
        SMapSolver = RidgeCV()
    elif 'Lasso CV' in newSolver :
        SMapSolver = LassoCV( cv = 5 )
    elif 'Elastic Net CV' in newSolver :
        SMapSolver = ElasticNetCV( l1_ratio = l1_ratio, cv = 5 )
    elif 'Ridge' in newSolver :
        SMapSolver = Ridge( alpha = alpha )
    elif 'Lasso' in newSolver :
        SMapSolver = Lasso( alpha = alpha )
    elif 'Elastic Net' in newSolver :
        SMapSolver = ElasticNet( alpha = alpha, l1_ratio = l1_ratio )
    else :
        SMapSolver = None
Instantiate sklearn solver based on solver and parameters
Instantiate sklearn solver based on solver and parameters
Instantiate sklearn solver based on solver and parameters
def NewSolver( newSolver ):
    global SMapSolver
    if not sklearnImported :
        solver = None
        dfOutput.clear_output()
        with dfOutput:
            display( print( "sklearn module not imported, using SVD solver." ) )
        return
    UpdateArgs()
    alpha = Widgets['alpha'].value 
    l1_ratio = [ float(x) for x in Widgets['l1_ratio'].value.split() ]
    if len( l1_ratio ) == 1 :
        l1_ratio = l1_ratio[0]
    if 'SVD' in newSolver :
        SMapSolver = None
    elif 'Ridge CV' in newSolver :
        SMapSolver = RidgeCV()
    elif 'Lasso CV' in newSolver :
        SMapSolver = LassoCV( cv = 5 )
    elif 'Elastic Net CV' in newSolver :
        SMapSolver = ElasticNetCV( l1_ratio = l1_ratio, cv = 5 )
    elif 'Ridge' in newSolver :
        SMapSolver = Ridge( alpha = alpha )
    elif 'Lasso' in newSolver :
        SMapSolver = Lasso( alpha = alpha )
    elif 'Elastic Net' in newSolver :
        SMapSolver = ElasticNet( alpha = alpha, l1_ratio = l1_ratio )
    else :
        SMapSolver = None
def NewSolver ( newSolver ) : global SMapSolver if not sklearnImported : solver = None dfOutput . clear_output ( ) with dfOutput : display ( print ( "sklearn module not imported, using SVD solver." ) ) return UpdateArgs ( ) alpha = Widgets [ 'alpha' ] . value l1_ratio = [ float ( x ) for x in Widgets [ 'l1_ratio' ] . value . split ( ) ] if len ( l1_ratio ) == 1 : l1_ratio = l1_ratio [ 0 ] if 'SVD' in newSolver : SMapSolver = None elif 'Ridge CV' in newSolver : SMapSolver = RidgeCV ( ) elif 'Lasso CV' in newSolver : SMapSolver = LassoCV ( cv = 5 ) elif 'Elastic Net CV' in newSolver : SMapSolver = ElasticNetCV ( l1_ratio = l1_ratio , cv = 5 ) elif 'Ridge' in newSolver : SMapSolver = Ridge ( alpha = alpha ) elif 'Lasso' in newSolver : SMapSolver = Lasso ( alpha = alpha ) elif 'Elastic Net' in newSolver : SMapSolver = ElasticNet ( alpha = alpha , l1_ratio = l1_ratio ) else : SMapSolver = None
Instantiate sklearn solver based on solver and parameters
Instantiate sklearn solver based on solver and parameters
'''Instantiate sklearn solver based on solver and parameters''' # FloatText widget # Convert l1_ratio text string to float [] # JP: Elastic Net Kludge since alpha is scalar. #     alpha and l1_ratio need to be same dimension, we have alpha scalar #     Need to generalize alpha to Text/vector?
newSolver