The book
Software Design Methods
with
Wolfram Language

Anton Antonov, Accendo Data LLC

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf

ABSTRACT

This presentation focuses on the book “Software Design Methods with WL”.
We start with a brief overview of the content, then showcase and discuss paclets that implement these software methodologies. Lastly, we delve into related examples of incorporating LLMs in software solutions.

Link to "Software Design Methods with Wolfram Language" (published as a paclet.)

Big picture

How it started:

Which Software Design methods?

Object-Oriented Programming (OOP) Design Patterns

Monadic programming

Functional parsers & Grammars

Meta-programming

Book Features

Diagnosis & proposed cures

Why use those techniques?

Extensive use of diagrams

Didactic examples

Real life examples

Actual packages & paclets

Cross language perspectives

Mathematical justifications

Relational algebra

Monad axioms

Line graph duality

Target audience

WL programmers writing packages, frameworks, reusable code

“Casual” WL programmers, who want “strengthen” their code

Non-WL programmers who want to see familiar method in WL

LLMs

Tutoring

Code generation

Book status

≈ 80% completed for at least 5 years

Needed (preliminary) chapters for:

Philosophical and methodological background

Reasons to use the methods

Currently, ≈90% completed

Format:

WL notebooks,

Markdown files

Paclet (booklet?)

Has LLM personas for application of its methods

The use of LLMs

Tutoring

Code generation

By full text of each chapter

By example

Making of flavored book versions

Deriving of new Design Patterns

Bragging, dogmatic, and obnoxious statements

... in this presentation.

It is more fun to write and present in that way!

Well, for some...

Why do that?

In case you do not like that exposition style.

Most people:

Do not like to program, but they have to.

Do not know well more than one programming language.

Do not care are interested in serious learning of methodology.

Are only interested in getting implementing the functionalities, not “extensible and maintainable software.”

Do not want apply a programming language, just workflows.

Mathematica (Mma) vs. Wolfram Language (WL)

Maximum expression with a minimal set of operations (Mma)

Having a complicated language instead (WL)

Mma is/was made for brilliant physicists.

WL less so, but still, kind of is...

Maybe WL is very competitive via LLMs, maybe not...

Comparison

I have written many packages in many programming languages.

(Usually) well documented with unit tests.

Do you “like” or “trust” programming languages that designed by:

Native English speakers

Dutch or Scandinavians

Physicists

Linguists

Computer Scientists

Questions for people who people who argue with me

Do you know what you talking about?

Do you have first hand experience or are you just parroting opinions?

BTW, I ask this question myself, fairly often.

How many programming languages you have mastered?

In how many languages you:

Can program without LLMs

Can program with LLMs help

Have been able to program without LLMs, but now you need LLMs to do so

Are you a programmer or a user?

Have you just mastered the workflows of certain packages of certain programming languages?

Say, Python “pandas”, or R “tidyverse”.

How many software packages or web/mobile apps have you written?

In what programming languages?

Do they have documentation, and/or presentations, and/or unit- and correctness tests?

Mathematical justifications

OOP and Design Patterns are not just instances of “fashion of thought.”

Can be proven and explained with well established mathematical methodologies and theories.

Fourier analysis vs Wavelets

Riemann integration vs Lebesgue integration

Functional Analysis

Relational Algebra (RDBMs)

Monads give practical advantages because of their algebraic properties.

Methodologies from the perspective of:

Graph Theory

System Dynamics

Preliminary examples

OOP Design patterns (Template Method)

Monads (Classification + LLM)

Functional Parsers

Grammars

OOP Design patterns (Template method)
Preliminary examples (1/4)

Just a coding discipline nothing else!

Definition

ClearAll[AbstractClass,ConcreteOne,ConcreteTwo];

CLASSHEAD=AbstractClass;
AbstractClass[d_]["Data"[]]:=d;
AbstractClass[d_]["op1"[]]:=d[[1]];
AbstractClass[d_]["op2"[]]:=d[[2]];
AbstractClass[d_]["alg"[]]:=CLASSHEAD[d]["op1"[]]+CLASSHEAD[d]["op2"[]]

ConcreteOne[d_][s_]:=Block[{CLASSHEAD=ConcreteOne},AbstractClass[d][s]]
ConcreteOne[d_]["op1"[]]:=d[[1]];
ConcreteOne[d_]["op2"[]]:=d[[1]]*d[[2]];

ConcreteTwo[d_][s_]:=Block[{CLASSHEAD=ConcreteTwo},AbstractClass[d][s]]
ConcreteTwo[d_]["op1"[]]:=d[[1]];
ConcreteTwo[d_]["op2"[]]:=d[[3]]^d[[2]];

Objects

obj1=ConcreteOne[{a,232,b}]

obj1["alg"[]]

obj2=ConcreteTwo[{a,232,b}]

obj2["alg"[]]

UML diagram (via Introspection)

See the paclet "UMLDiagramGeneration".

UMLClassGraph[{AbstractClass,ConcreteOne,ConcreteTwo},{AbstractClass->{"op1","op2"}},"Abstract"->{AbstractClass},VertexLabelStyle->"Text",GraphLayout->{"LayeredEmbedding","Orientation"->Top}]

Monads
Preliminary examples (2/4)

Monadic pipeline with LLM segments

SeedRandom[33];
clObj2=
LLMClCon["use the dataset dsTitanic"]⟹
LLMClCon["split the data with 0.75 ratio"]⟹
LLMClCon["summarize the data"]⟹
LLMClCon["make a logistic regression classifier"]⟹
LLMClCon["show classifier measurements"]⟹
LLMClCon["show ROC plots using image size 400"];

clObj2

clObj2⟹LLMClCon["Take the classifier object"]

Functional parsers
Preliminary examples (3/4)

p=IntType⊙(ParseSymbol["numerical"]⊕ParseSymbol["symbolic"])⊗ParseSymbol["integration"];

p@ToTokens@"numerical integration"

p@ToTokens@"symbolic integration"

Grammars
Preliminary examples (4/4)

Random sentences for grammar

ebnf="
<top> = <who> , <verb> , <lang> ;
<who> = 'I' | 'We' ;
<verb> = 'love' | 'hate' | 'like' | { '❤️' } | '🤮' <@ MyVerb ;
<lang> = 'Julia' | 'Perl' | 'Python' | 'R' | 'Raku' | 'WL' <@ MyLang ; 
";

(*SeedRandom[329]*)
GrammarRandomSentences[ebnf,8]//ColumnForm

Inter-relationship

The methods discussed relate to each other in this way:

MermaidJS["
graph
	DP[OOP Design Patterns]
	Mon[Monadic Programming]
	FP[Functional Parsers]
	G[Grammars]
	DP --> |Command DP|Mon
	Mon --> FP
	G --> |generation|FP
	G --> |Interpreter DP|DP
	DP --> |Interpreter DP|FP
","PDF",ImageSize->Large]

WL version

Graph[
{DirectedEdge["OOP Design Patterns","Monadic Programming","Command DP"], DirectedEdge["Grammars","Functional Parsers","generation"],
DirectedEdge["Grammars", "OOP Design Patterns","Interpreter DP"],DirectedEdge[ "OOP Design Patterns","Functional Parsers","Interpreter DP"]
},
VertexLabels->Placed[Automatic,Above],
VertexLabelStyle->Directive[Purple,Bold,16],
VertexSize->Small,
VertexStyle->LightBlue,
EdgeLabels->"EdgeTag",
EdgeLabelStyle->Directive[GrayLevel[0.3],Bold,14],
GraphLayout->"SpringElectricalEmbedding"
]

Typical Development Processes

Objects interchanging messages

Refining functions into DSLs

Making pipelines

Signature analysis

AKA "Dimensional analysis"

Objects interchanging messages (1/3)

Dialectical Materialism perspective

No, OOP is not fully Marxist

But using Marx quotes in OOP papers / books seem always relevant

Which entities exchange what messages?

What are the “hot spots” of the system?

What is common, or invariant, or variable?

Discovery of classes

Different types: analysis, design, and implementation

Where the fundamental patterns apply?

Template Method and Strategy

Where the second wave patterns apply?

Decorator, Composite, Freight, and others

Which creation patterns apply?

Almost always, Builder and Abstract Factory

Refine, rethink,  and program

Preliminary verbal descriptions and UML diagrams help

Yes, LLMs can be used over those to generate code

Refining functions into DSLs (2/3)

1. Identify Complexity: Recognize when a program component becomes too large and complex.
2. Divide Program: Break down the program into smaller, comprehensible parts.
3. Apply Bottom-Up Design: Develop new operators or utilities as needed to address specific problems.
4. Integrate New Operators: Use newly created operators to simplify and refine existing program components.
5. Iterate and Evolve: Continuously refine the language and program together, identifying patterns and opportunities for simplification.
6. Promote Code Reuse: Utilize utilities across multiple programs to reduce effort and increase efficiency.
7. Simplify Program Structure: Aim for a smaller, more abstract language with a concise program.
8. Enhance Readability: Ensure the program is easy to read by using general-purpose operators.
9. Refinement Loop: Revisit and refine components as new patterns and simplifications are identified.

See Paul Grahams book “On Lisp” for more detailed description. (Chapter 1, “The Extensible Language.”)

Alternatively, see Leonid Shifrin’s MSE answer here.

Signature analysis (3/3)

Seen in Haskell programming...

Very similar to Dimensional Analysis (in Physics and Chemistry.)

See Rayleigh's method.

Why use those methods?

Why use:

OOP Design Patterns

Monadic Programming

Grammars & Functional Parsers

OOP Design Patterns

Why design patterns?

OOP’s deficiencies are addressed with Design Patterns (DPs)

Distilled from real life

Teaching OOP in the wrong way

There is no point to simulate OOP in WL at object level

Implementation at DPs is most appropriate

Theoretical background

Mathematical proofs why DPs should be used

Relational algebra

Technical examples

Real life examples

DPs can be found in many functionalities of WL

Why design patterns? 
OOP Design Patterns (1/5)

Remark: See MSE "Which object-oriented paradigm approach to use in Mathematica?".

Having a language to communicate micro-architectural designs

Design patterns:

Have relations between each other

Some can muttate into each other

Proven successful application

Facilitate knowledge transfer

Help thinking on a “higher level”

There is no point to simulate OOP in WL at object level
OOP Design Patterns (2/5)

Most important point:

There is no point to simulate OOP in WL at object level.

All other approaches I have seen try to emulate OOP in WL at object level

I find that cumbersome almost counter productive

Needing too much complicated additional code to be supported

Not easily transferable

Theoretical background
OOP Design Patterns (3/5)

Seeing code as a database

Functions/methods code is data

Function names and signatures are keys

Design patterns can be seen as putting the code in 3rd Normal Form (3NF)

The core patterns were worked using Relational Algebra

Technical examples
OOP Design Patterns (4/5)

I spent some time training an LLM persona (or three) to be able to generate class hierarchies using Design Patterns specs.

Real life examples
OOP Design Patterns (5/5)

In Wolfram Language

NIntegrate

Template Method, Strategy, Builder, Abstract Factory, Decorator, Composite

NDSolve

Template Method, Strategy, Builder, Abstract Factory

Dynamic &  Manipulate

MVC / Observer

RadialAxisPlot

Finite State Machine for data acquisition

OOPFiniteStateMachine

"Multi-Language Data Acquisition Conversational Agent" WTC-2021

Dynamic example

Dynamic[n]

Slider[Dynamic[n],{-100,100}]

Dynamic[NIntegrate[Sin[t],{t,-Pi,n}]]

Monadic Programming

Why Monadic Programming?

The space of functional transformations

Algebra between the operations

Technical examples

Real life examples

Why monadic programming? 
Monadic Programming (1/4)

Simple motivation -- less "syntactic sugar"

Thinking in pipelines

Fast and flexible construction of computational workflows

Data wrangling pipelines

Here is a natural language specification of a data transformation workflow:

spec="
use dsTitanic; 
group by passengerClass and passengerSex;
counts";

Remark: We call this kind of specifications Domain Specific Language (DSL) specifications.

Here is how this DSL specification is translated to R and WL:

langs={"Python","R","WL"};
GridTableForm[{#,DSLTranslation[spec,"ToLanguage"->#,"WLCode"->False]}&/@langs,TableHeadings->{"Language","Code"}]

The space of functional transformations
Monadic Programming (2/4)

Algebra between the operations

Schematically

imgClCon=;
imgWorm=;
imgPipe=;
Block[{imgSize=700},TabView[{"ClCon"->Show[imgClCon,ImageSize->1.5*imgSize],"Color Worm"->Show[imgWorm,ImageSize->imgSize],"Brass pipe"->Show[imgPipe,ImageSize->imgSize]}]
]

Technical examples
Monadic Programming (3/4)

Generate a software monad with the prefix “Perhaps”:

GenerateStateMonadCode["Perhaps"]

Make a monadic pipeline with the monad tracer that shows the changes of pipeline’s value and tabulates pipeline’s operations with corresponding descriptions:

SeedRandom[332];
TraceMonadUnit[PerhapsUnit[RandomInteger[10,15]]]⟹"lift to monad"⟹
TraceMonadEchoContext⟹
PerhapsEcho⟹"display current value"⟹
PerhapsWhen[#[[3]]>3&,PerhapsEchoFunctionValue[Style[#,Red]&]]⟹"display pipeline's value if the 3d element is greater than 3"⟹
(PerhapsUnit[#/4]&)⟹"replace the pipeline object"⟹
PerhapsEcho⟹"display current value again"⟹
TraceMonadEchoGrid[Grid[#,Sequence[Dividers->All,FrameStyle->GrayLevel[0.7],Alignment->Left]]&];

Real life examples
Monadic Programming (4/4)

Monadic paclets

Machine learning software monads in three different languages: (Python, R, WL)

Quantile regression (WL)

qrObj =
QRMonUnit[dfTemperatureData] ⟹
QRMonEchoDataSummary[] ⟹
QRMonQuantileRegression[20, {0.25, 0.5, 0.75}, InterpolationOrder -> 3] ⟹
QRMonPlot["DateListPlot" -> True, PlotTheme -> "Detailed"] ⟹
QRMonErrorPlots["RelativeErrors" -> False, "DateListPlot" -> True, PlotTheme -> "Detailed"];

In Python and R

res=
Concretize[
"use the dfTemperatureData data to construct a quantile regression with 20 knots",
"TargetLanguage"->"Python",
Method->FindTextualAnswer
]

Functional Parsers & Grammars

Why Functional parsers & Grammars

Functional parsers

Grammars

Functional parsers as Monadic programming

Technical examples

Real life examples

Why functional parsers & grammars?
Functional Parsers & Grammars (1/6)

DSLs can “solve” complicated use cases

Complicated but well understood inter-dependencies

Same as the Interpreter design pattern

Grammars make DSL specification and implementation easier

Parsers can be generated from grammars

Conjecture: because of LLMs, grammars and parsers would be more widely used

Functional Parsers
Functional Parsers & Grammars (2/6)

Define a “FP space” of core parsing functions

Have combinators between them

The combinators give results in the “FP space”

p=ParseSymbol["a"]⊗(ParseSymbol["K"]⊕ParseSymbol["M"])

p@Characters@"aK"

ParseShortest[GotIt⊙p]@Characters@"aKkdlf"

Grammars
Functional Parsers & Grammars (3/6)

Arithmetic

LLMSynthesize[{
"Generate EBNF grammar of arithmetic expressions.",
"Make sure standard operations is properly reflected.",
LLMPrompt["NothingElse"]["EBNF"]
}]//ResourceFunction["ImportMarkdownString"]

Email

LLMSynthesize[{
"Generate EBNF grammar of email addresses.",
LLMPrompt["NothingElse"]["EBNF"]
}]//ResourceFunction["ImportMarkdownString"]

Integration

LLMSynthesize[{
"Generate EBNF grammar of numerical and symbolic integration specifications.",
"Make sure all phrases and words are into separate literals.",
"Provide a few versions for phrases like \"with respect to\", \"from\", \"to\", etc.",
"Assume <expression>, <identifier>, and <variable> are defined in another EBNF grammar -- so, no need to difine them.",
LLMPrompt["NothingElse"]["EBNF"]
},
LLMEvaluator->LLMConfiguration["Model"->"gpt-4o-mini"]
]//ResourceFunction["ImportMarkdownString"]

Functional parsers as monadic programming
Functional Parsers & Grammars (4/6)

The operations ⊕, ⊗, ⊙ navigate the parser combiners function space

I.e. no arguments / signatures are specified while using those operations.

Monadic laws can be verified.

p=(ParseSymbol["general"]⊗MyGenType⊙(ParseSymbol["failure"]⊕ParseSymbol["assumption"]))

p@ToTokens@"general failure"

p@ToTokens@"general assumption"

Technical examples
Functional Parsers & Grammars (5/6)

Parser

p3=ParseApply[First[#]@@Map[ToExpression,Rest[#]]&@Flatten[#]&,((MyNIntegrate&)⊙ParseSymbol["numerical"]⊕(MyIntegrate&)⊙ParseSymbol["symbolic"])⊗((ParseSymbol["integration"]⊗(ParseSymbol["of"]⊕ParseSymbol["for"]))⊳ParsePredicate[StringQ])⊗((ParseSymbol["over"]⊕ParseSymbol["for"])⊗ParseOption[ParseSymbol["the"]]⊗(ParseSymbol["range"]⊕ParseSymbol["domain"])⊳ParsePredicate[StringQ])];

Interpretations

p3@*ParseToTokens@"numerical integration of Sqrt[x] over the range {x,0,1}"

Block[{MyIntegrate=Integrate,MyNIntegrate=NIntegrate},%]

p3@*ParseToTokens@"symbolic integration of 2*x over the range {x,a,b}"

Block[{MyIntegrate=Integrate,MyNIntegrate=NIntegrate},%]

Table

queries={
"symbolic integration of Log[x] over the range {x,0,y}",
"numerical integration for 1/t for the domain {t,1,10}"
};
pres=ParsingTestTable[ParseShortest[p3],queries,"TokenizerFunction"->ParseToTokens,"Layout"->"Vertical"]

Real life examples
Functional Parsers & Grammars (6/6)

Parsing numeric word forms

(HyperlinkTemplate["Integer names parsing", paclet:AntonAntonov/FunctionalParsers/tutorial/Integernamesparsing, paclet:AntonAntonov/FunctionalParsers/tutorial/Integernamesparsing, Link, HyperlinkActive, , ])

(Web page)

Meta-programming

Meta-programming can be:

Introspection

Code generation

Monad making

Call graph

UML diagrams for WL OOP code

Graphs for System Dynamics models

And vice-versa

"Making graphs over system dynamics models"

Future plans

Finish the book -- version 1.0 -- by 2024-10-31

Current version 0.7

GoFBot

✓ LLM prompt and submission

✓ Tests with simple cases

□ Tests with complex requests

Monadic code generators

✓ Concretizing by templates

Fully productized

LLM pipeline segments

✓ Per monad implementations

□ Paclet

Functional Parser code generation

✓ Grammar-based (Raku)

✓ Faithful EBNF

✓ Loose EBNF

□ Grammar-based (WL)

✓ Faithful EBNF

□ Loose EBNF

LLM based

In progress...

Acknowledgements

Nirmal Malapaka 
(Kernel Developer at WRI)

Adoption

Discussions

Encouragement

Additional comments and observations

Emulating OOP at object level is cumbersome and produces clumsy code.

It is wrong to teach monads via the (so called) Maybe monad.

Anti-patterns are relevant and related cures apply.

See "Big Ball of Mud".

Analogies of Lebesgue integration and Wavelet analysis with OOP.

Riemann integration and Fourier analysis are like Structural programming.

Learning Software Architecture is a life-long quest.

But Design Patterns and Monads are shortcuts in that regard (for smaller projects.)

Conjecture: because of LLMs grammars and parsers would become more useful.

Conjecture: Finishing the book by October 31st, 2024.

References

Articles, books

[AA1] Anton Antonov, Object-Oriented Design Patterns in Mathematica | Mathematica for prediction algorithms, (2016.)

[BM1] Bertrand Meyer, "Object-Oriented Software Construction", 2nd ed., (1997), Prentice Hall. ISBN-13: 978-0136291558.

[PG1] Paul Graham, On Lisp, (1993), Prentice Hall, ISBN-10: 0130305529, ISBN-13: 978-0130305527.

Functions, packages, paclets

[AAp1] Anton Antonov, "SoftwareDesignMethodsWithWL" WL paclet,  (2024),
Wolfram Language Paclet Repository.

I plan to complete the book by October 31st.

[AAp2] Anton Antonov, "CallGraph" WL paclet,  (2023),
Wolfram Language Paclet Repository.

[AAp3] Anton Antonov, "MonadMakers" WL paclet,  (2023),
Wolfram Language Paclet Repository.

[AAp4] Anton Antonov, "MonadicContextualClassification" WL paclet,  (2024),
Wolfram Language Paclet Repository.

[AAp5] Anton Antonov, "MonadicGeometricNearestNeighbors" WL paclet,  (2023),
Wolfram Language Paclet Repository.

[AAp6] Anton Antonov, "MonadicLatentSemanticAnalysis" WL paclet,  (2023),
Wolfram Language Paclet Repository.

[AAp7] Anton Antonov, "MonadicQuantileRegression" WL paclet,  (2023),
Wolfram Language Paclet Repository.

[AAp8] Anton Antonov, "MonadicSparseMatrixRecommender" WL paclet,  (2024),
Wolfram Language Paclet Repository.

Videos

[AAv1] Anton Antonov, Wolfram Videos: Object Oriented Design Patterns, WTC-2015.

[AAv2] Anton Antonov, Wolfram Videos: Monadic Programming: With Application to Data Analysis, Machine Learning and Language Processing, WTC-2017.

Setup code

Paclets

Needs["AntonAntonov`MermaidJS`"]
Needs["AntonAntonov`UMLDiagramGeneration`"]
Needs["AntonAntonov`DSLTranslation`"]
Needs["AntonAntonov`DataReshapers`"]
Needs["AntonAntonov`MonadMakers`"]
Needs["AntonAntonov`FunctionalParsers`"]
Needs["AntonAntonov`MonadicLatentSemanticAnalysis`"]
Needs["AntonAntonov`MonadicContextualClassification`"]
Needs["AntonAntonov`MonadicQuantileRegression`"]
Needs["AntonAntonov`MonadicSparseMatrixRecommender`"]
Needs["AntonAntonov`NLPTemplateEngine`"]

Data

Quantile Regression

tsFinData=FinancialData["NYSE:GE",{{2020,1,1},{2022,1,1},"Day"}];
dfFinData=QuantityMagnitude@tsFinData["Path"];

tsTemperatureData=WeatherData[{"Orlando","Florida"},"Temperature",{{2020,1,1},Now,"Day"}];
dfTemperatureData=QuantityMagnitude@tsTemperatureData["Path"];

Latent Semantic Analysis

dsAbstracts=ResourceFunction["ImportCSVToDataset"]["https://raw.githubusercontent.com/antononcube/SimplifiedMachineLearningWorkflows-book/master/Data/Wolfram-Technology-Conference-2016-to-2019-abstracts.csv"];
aAbstracts=Normal@dsAbstracts[Association,#ID->#Abstract&];

Length[aAbstracts]

RandomSample[dsAbstracts,4]

Classification

dsTitanic=ResourceFunction["ImportCSVToDataset"]["https://raw.githubusercontent.com/antononcube/MathematicaVsR/master/Data/MathematicaVsR-Data-Titanic.csv"];

RandomSample[dsTitanic,6]

LLM functions

Code formatting

FormatWL=
LLMExampleFunction[{
"qrObj=QRMonUnit[dfTemperature]⟹QRMonEchoDataSummary[]⟹QRMonQuantileRegression[20, {0.25, 0.5, 0.75}, InterpolationOrder->3]⟹QRMonPlot[\"DateListPlot\"->False,PlotTheme->\"Detailed\"];"
->"qrObj=\nQRMonUnit[dfTemperature]⟹\nQRMonEchoDataSummary[]⟹\nQRMonQuantileRegression[20, {0.25, 0.5, 0.75}, InterpolationOrder->3]⟹\nQRMonPlot[\"DateListPlot\"->False,PlotTheme->\"Detailed\"];",
"ClConUnit[dfTitanic]⟹ClConEchoDataSummary⟹ClConMakeClassifier[\"RandomForest\"];"
->"ClConUnit[dfTitanic]⟹\nClConEchoDataSummary⟹\nClConMakeClassifier[\"RandomForest\"];",
"Hold[qrObj=QRMonUnit[dfTemperature]⟹QRMonEchoDataSummary[]⟹QRMonQuantileRegression[20,{0.25`,0.5`,0.75`},InterpolationOrder->3];]"
->"qrObj=\nQRMonUnit[dfTemperature]⟹\nQRMonEchoDataSummary[]⟹\nQRMonQuantileRegression[20,{0.25`,0.5`,0.75`},InterpolationOrder->3];"
},
LLMEvaluator->LLMConfiguration[<|"Model"->"gpt-4o","Prompts"->"Make sure your produce CORRECTR Mathematica code. Keep the double quotes of the option values."|>]];

ClCon

fLLMForClCon=LLMExampleFunction[{
"use the data dfSOXE"->"ClConUnit[dfSOXE]",
"split the data with ration 0.64"->"ClConSplitData[0.64]",
"split data intor training and testing parts using training data ratio 0.72"->"ClConSplitData[0.72]",
"Summarize the data"->"ClConEchoDataSummary",
"show data breakdown"->"ClConEchoDataSummary",
"echo data summary"->"ClConEchoDataSummary",
"Train a classifier using logistic regression algorithm"->"ClConMakeClassifier[\"LogisticRegression\"]",
"classifier creation with using random forest"->"ClConMakeClassifier[\"RandomForest\"]",
"make a nearest neighbors classifier"->"ClConMakeClassfier[\"NearestNeighbors\"]",
"show classifier measurements"->"Function[{v,c},ClConUnit[v,c]⟹ClConClassifierMeasurements[{\"Accuracy\",\"Precision\",\"Recall\"}]⟹ClConEchoValue]",
"classifier information"->"ClConEchoFunctionContext[Information[#classifier]&]",
"plot the ROC functions PPV and FPR"->"ClConROCPlot[\"PPV\",\"FPR\"]",
"show ROC plots"->"ClConROCPLot",
"give ROC plots with image size 900"->"ClConROCPLot[ImageSize->900]",
"I wanna see the confusion matrix plot here"->"Function[{v,c},ClConUnit[v,c]⟹ClConClassifierMeasurements[{\"ConfusionMatrixPlot\"}]⟹ClConEchoValue]",
"echo pipeline value"->"ClConEchoValue",
"show the pipeline context"->"ClConEchoContext",
"reduce the dimension to 14 topics"->"ClConReduceDimension[14]"
}];

Clear[LLMClCon];
LLMClCon[s_String]:=
Block[{res},
res=fLLMForClCon[s];
res=StringTrim@StringReplace[res,{"Output:"->"","Output :"->""}];
ToExpression[res]
];