Skip to content

Conversation

@AvanishSalunke
Copy link
Contributor

though a previous initiative was taken to build this parser , #363

Here is a refined formulaparser.m that does support the fit models and anova function.

This is what has been implemented in short :

  1. A lexer function (run_lexer) to convert the input strings into tokens.
  2. A parser function (run_parser) to build the tree and support the precedence rules.
  3. A expander function (run_expander) for creation of big eexplicit terms.
  4. A schema builder function (run_schema_builder) which constructs a binary term matrix at the end.
  5. A matrix builder (run_model_matrix_builder) to build the design matrix at the end.

Demos, documentation, BISTs have been added lately.

Not sure about the position of formulaparser in the INDEX file.

@AvanishSalunke AvanishSalunke changed the title Implemented formulaparser.m Implement formulaparser.m Jan 30, 2026
@pr0m1th3as
Copy link
Member

pr0m1th3as commented Jan 30, 2026

I think parseWilkinsonNotation or parseWilkinsonFormula is a more appropriate name for this function. The statistics package already has a parseScoreTransform private function, so it makes sense to keep this kind of naming convention for specialized parser functions.

Can you add support for ^ as an "OP_POWER" operation and multiple return variables (repeated measures), as in "y1-y5 ~ x1:x2" or "y1,y4,y5 ~ x1^3"?

@AvanishSalunke
Copy link
Contributor Author

@pr0m1th3as yes sure!! will come up with the changes.

@Pasta-coder
Copy link
Contributor

you opened this PR without referencing the roadmap we established in Issue #266 or the ongoing discussion in #363. Since I am actively working on the LinearModel class structure which relies on this parser, it would have been better to coordinate to avoid overlapping efforts.
Also , this PR lacks removing partially implemented parser in GAMs (this was discussed in #266)

@pr0m1th3as
Copy link
Member

you opened this PR without referencing the roadmap we established in Issue #266 or the ongoing discussion in #363. Since I am actively working on the LinearModel class structure which relies on this parser, it would have been better to coordinate to avoid overlapping efforts. Also , this PR lacks removing partially implemented parser in GAMs (this was discussed in #266)

The PR #363 is stalled because I explicitly asked you to stop pouring AI slop into that PR, but you kept going in the same direction. I haven't had the time to update the contribution guidelines yet, but let me be crystal clear about. I will not accept or tolerate any kind of contribution in any of the packages I maintain if I see any signs that it is the result of vibe coding.

@AvanishSalunke AvanishSalunke marked this pull request as draft January 31, 2026 15:48
@AvanishSalunke
Copy link
Contributor Author

Hello @pr0m1th3as the changes have now been completed, firstly since "-" was already deletion operation and commas in LHS were not processed, now the formula is split into LHS and RHS and processed likewise. I also aded a new helper function to create list of the variables on the LHS side and the RHS side is processed as per the previous implementation but as ~RHS

@AvanishSalunke AvanishSalunke marked this pull request as ready for review February 2, 2026 14:39
@pr0m1th3as pr0m1th3as merged commit d23f164 into gnu-octave:main Feb 3, 2026
@AvanishSalunke AvanishSalunke deleted the formulaparser branch February 3, 2026 10:28
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.

3 participants