Hi everyone
I try to use sklearn.neural_network.MLPClassifier to test the XOR
operation, but I found the result is not satisfied. The following is code, can
you tell me if I use the lib incorrectly?
from sklearn.neural_network import MLPClassifier
X = [[0, 0], [0, 1], [1, 0], [1, 1]]
y =
Hi,
Sometimes when using GridSearchCV, I realize that in the grid there are
certain combinations of hyperparameters that are either incompatible or
redundant. For example, when using an MLP, if I specify the following grid:
grid = {'solver': ['sgd', 'adam'], 'learning_rate': ['constant',
'invscal
Hi!
What you could do is specify lists of dicts to group the parameters which
apply together in one dict...
[{'learning_rate': ['constant', 'invscaling', 'adaptive'], 'solver':
'sgd'}, {'solver': 'adam'}]
```py
from sklearn.neural_network import MLPClassifier
from sklearn.model_selection import
Hi,
If you keep everything at their default values, it seems to work -
```py
from sklearn.neural_network import MLPClassifier
X = [[0, 0], [0, 1], [1, 0], [1, 1]]
y = [0, 1, 1, 0]
clf = MLPClassifier(max_iter=1000)
clf.fit(X, y)
res = clf.predict([[0, 0], [0, 1], [1, 0], [1, 1]])
print(res)
```
Yes,you are right @ Raghav R V, thx!
However, i found the key param is ‘hidden_layer_sizes=[2]’, I wonder if I
misunderstand the meaning of parameter of hidden_layer_sizes?
Is it related to the topic :
http://stackoverflow.com/questions/36819287/mlp-classifier-of-scikit-neuralnetwork-not-work
On Wed, 23 Nov 2016 at 16:29 Raghav R V wrote:
> Hi!
>
> What you could do is specify lists of dicts to group the parameters which
> apply together in one dict...
>
> [{'learning_rate': ['constant', 'invscaling', 'adaptive'], 'solver':
> 'sgd'}, {'solver': 'adam'}]
>
> ```py
> from sklearn.neural
Raghav's example of
[{'learning_rate': ['constant', 'invscaling', 'adaptive'], 'solver':
'sgd'}, {'solver': 'adam'}]
was not correct.
Should be
[{'learning_rate': ['constant', 'invscaling', 'adaptive'], 'solver':
['sgd']}, {'solver': ['adam']}]
(Note all values of dicts are lists)
On 23 Nov
On Wed, 23 Nov 2016 at 17:31 Joel Nothman wrote:
> Raghav's example of
>
>
> [{'learning_rate': ['constant', 'invscaling', 'adaptive'], 'solver':
> 'sgd'}, {'solver': 'adam'}]
>
> was not correct.
>
> Should be
>
>
> [{'learning_rate': ['constant', 'invscaling', 'adaptive'], 'solver':
> ['sgd']},
On Wed, Nov 23, 2016 at 12:59 PM, Joel Nothman
wrote:
> Raghav's example of
>
>
> [{'learning_rate': ['constant', 'invscaling', 'adaptive'], 'solver':
> 'sgd'}, {'solver': 'adam'}]
>
> was not correct.
>
Oops sorry. Ah I ran into that, corrected it in the snipped but forgot to
update the line be
Hi Jaidev,
well, `param_grid` in GridSearchCV can also be a list of dictionaries,
so you could directly specify the cases you are interested in (instead
of the full grid - exceptions), which might be simpler?
On 23/11/16 11:15, Jaidev Deshpande wrote:
> Hi,
>
> Sometimes when using GridSearchCV,
> If you keep everything at their default values, it seems to work -
>
> ```py
> from sklearn.neural_network import MLPClassifier
> X = [[0, 0], [0, 1], [1, 0], [1, 1]]
> y = [0, 1, 1, 0]
> clf = MLPClassifier(max_iter=1000)
> clf.fit(X, y)
> res = clf.predict([[0, 0], [0, 1], [1, 0], [1, 1]])
11 matches
Mail list logo