BUG: `partial_fit()` input validation is lacking

Open
#160 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
50/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active

Research direction

Start with the reproducer in the issue: GFDLClassifier(hidden_layer_sizes=0, seed=0).partial_fit(X, y, classes=np.unique(y)) in gfdl/model.py. Compare it with how MLPClassifier validates the same parameter through validate_parameter_constraints, and check which parameters GFDL's partial_fit and fit validate. Done when a zero-size network is rejected with a clear error, and other inputs that the harness catches are checked too. The issue's scope is open-ended, so confirm the expected behaviour with maintainers first.

Written by the indexing model from the issue text.

Description

bug

The reproducer below the fold runs just fine on our latest main branch at the time of writing (hash: 768bf3c17), despite having no neurons in the estimator. Conversely, in a similar scenario, MLPClassifier correctly raises an InvalidParameterError. There are probably other examples of input validation being inferior on our end, since they're using a validate_parameter_constraints harness which I suspect catches a few other things we don't. In other words, I'm not so sure this is really constrained to just size 0 neural networks.

import numpy as np
from sklearn.datasets import make_classification
from gfdl.model import GFDLClassifier

X, y = make_classification(random_state=0)
GFDLClassifier(hidden_layer_sizes=0, seed=0).partial_fit(X, y, classes=np.unique(y))
Dominant language
Python
Stars
3
Forks
6
Avg merge
2d 3h
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lanl/GFDL

All issues in lanl/GFDL

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.