Skip to content

Conversation

@Sonu0305
Copy link
Contributor

No description provided.

## A 2-element numeric vector specifying the prior probabilities for each
## class. The order of the elements in @qcode{Prior} corresponds to the
## order of the classes in @qcode{ClassNames}. This property is read-only.
## A numeric vector specifying the prior probabilities for each class. The
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to change the property docstring. It is always a 2-element numeric vector.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I investigated matlab's working with Prior, so modified for MATLAB compatibility.

switch (s.subs)
case 'Cost'
this.Cost = setCost (this, val);
this.Cost = val;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep my previous change utilizing a priveate method so it can also be called from subsasgn

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using that, but when I tested, it was causing errors, I tried 2-3 ways but it didnt work, so came up with this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it doesn't work because my previous code was wrong. Instead of

this.Cost = setCost (this, val);

it should have been

this = setCost (this, val);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should I keep the current changes, since it is working well right?

Formula = [];
Interactions = [];
ClassNames = [];
Prior = "empirical";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior must be a 2-element numeric vector. Don't initialize it like this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same mentioned reason of MATLAB compatibility.

RSS = sum (res .^ 2);
endfunction

function this = setCost (this, Cost, gnY = [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to keep this private method. See my comment above

Copy link
Contributor Author

@Sonu0305 Sonu0305 Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same above mentioned reason for removing it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comment above

%! assert (a.DoF, [7, 7, 7])
%! assert (a.BaseModel.Intercept, 0.4055, 1e-1)

## Test Prior calculation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to document this name-value argument in the constructor's help docstring

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    ## @item @qcode{'Prior'} @tab @tab A numeric vector specifying the prior
    ## probabilities for each class.  The order of the elements in @qcode{Prior}
    ## corresponds to the order of the classes in @qcode{ClassNames}.
    ## Alternatively, you can specify @qcode{"empirical"} to use the empirical
    ## class probabilities or @qcode{"uniform"} to assume equal class
    ## probabilities.

Is this what you are talking about? If yes, then it is already added in the file.

@Sonu0305 Sonu0305 requested a review from pr0m1th3as October 31, 2025 19:32
@pr0m1th3as pr0m1th3as merged commit d146d05 into gnu-octave:main Nov 2, 2025
pr0m1th3as added a commit that referenced this pull request Nov 2, 2025
@Sonu0305 Sonu0305 deleted the gam branch November 2, 2025 16:35
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

Successfully merging this pull request may close these issues.

2 participants