Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use F1 objective, because w is set to None #1

Open
wolpl opened this issue Sep 9, 2020 · 0 comments
Open

Cannot use F1 objective, because w is set to None #1

wolpl opened this issue Sep 9, 2020 · 0 comments

Comments

@wolpl
Copy link

wolpl commented Sep 9, 2020

When running the fit(X,y) method of the GOSDT python class, I consistently get the following error message (trace shortened):

Traceback (most recent call last):
...
  File ".../gosdt.py", line 95, in fit
    self.__python_train__(X, y)
  File ".../gosdt.py", line 273, in __python_train__
    leaves_c, pred_c, dic, nleaves, m, n, totaltime, time_c, R_c, COUNT, C_c, accu, best_is_cart, clf = bbound(
  File ".../imbalance/osdt_imb_v9.py", line 1875, in bbound
    root_leaf = CacheLeaf(name, n, P, N, (), x, y, y_mpz, z_mpz, make_all_ones(n + 1),
  File ".../imbalance/osdt_imb_v9.py", line 1676, in __init__
    self.pred = bound.leaf_predict(self.p, self.n, w)
  File ".../imbalance/osdt_imb_v9.py", line 1344, in leaf_predict
    if w * p <= n:
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

When printing the variables w, p and n prior to the last call (line 1344 in osdt_imb_v9.py) I can see that w is None, the other two are not.

It seems to me that using the F1-score is impossible, because in gosdt.py the configuration entry for w is set to None whenever F1 should be used. Unless w is altered somewhere the operation in osdt_imb_v9.py consequently has to fail. File gosdt.py, lines 85-87:

elif self.configuration["objective"] == "f1":
    self.configuration["theta"] = None
    self.configuration["w"] = None

Running the algorithm without specifying the objective and with other objectives like acc, bacc or wacc works perfectly fine. How can I use F1?
Is the C++ implementation able to optimize for an F1 objective function?

@wolpl wolpl changed the title Cannot use F1 objective, because w is set to None Cannot use F1 objective, because w is set to None Sep 9, 2020
achreto referenced this issue in ubc-systopia/gosdt-guesses Feb 25, 2022
Added depth_budget (hard depth constraint)
achreto referenced this issue in ubc-systopia/gosdt-guesses Feb 25, 2022
changed default configuration for feature_exchange (causes slowdowns when features have already been pruned by something like threshold guessing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant