syntax – Python: SyntaxError: keyword cant be an expression

syntax – Python: SyntaxError: keyword cant be an expression

sum.up is not a valid keyword argument name. Keyword arguments must be valid identifiers. You should look in the documentation of the library you are using how this argument really is called – maybe sum_up?

I guess many of us who came to this page have a problem with Scikit Learn, one way to solve it is to create a dictionary with parameters and pass it to the model:

params = {C: 1e9, gamma: 1e-07}
cls = SVC(**params)    

syntax – Python: SyntaxError: keyword cant be an expression

Its python source parser failure on sum.up=False named argument as sum.up is not valid argument name (you cant use dots — only alphanumerics and underscores in argument names).

Leave a Reply

Your email address will not be published. Required fields are marked *