[ 
https://issues.apache.org/jira/browse/SPARK-34415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18097996#comment-18097996
 ] 

Mao Li commented on SPARK-34415:
--------------------------------

Hi all — I'd like to pick this up, since it has been inactive since the 2021 
revert
(SPARK-36664, PR #33819). [~phenry]  please let me know if you still plan to 
work on
this; otherwise I'll take it forward.

I've re-implemented ParamRandomBuilder from scratch, addressing the reasons for 
the
revert directly:

1. True random sampling: build(numModels) draws each param independently for 
every
   candidate map (equivalent to sklearn's RandomizedSearchCV n_iter), instead 
of the
   original "sample n values per param, then take the Cartesian product".
2. Reproducibility contract ("MLlib algorithm's behavior should be fully 
determined by
   its params"): randomness is driven by an explicit constructor seed; same 
seed + same
   add* calls produce identical ParamMaps, verified by a dedicated test.
3. Narrower API surface: the Limits/Generator/RandomT type-class machinery is 
not
   revived; only concrete-typed addRandom/addLog10Random/addChoice overloads 
are public
   (which also keeps the API Java-friendly), with sampling internals 
private[ml].

Plan: Scala-first PR (builder + tests), then follow-ups for PySpark parity, Java
example and docs — keeping the initial diff small and focused on the API 
discussion.
Will open the PR shortly.

> Use randomization as a possibly better technique than grid search in 
> optimizing hyperparameters
> -----------------------------------------------------------------------------------------------
>
>                 Key: SPARK-34415
>                 URL: https://issues.apache.org/jira/browse/SPARK-34415
>             Project: Spark
>          Issue Type: New Feature
>          Components: ML, MLlib
>    Affects Versions: 3.0.1
>            Reporter: Phillip Henry
>            Assignee: Phillip Henry
>            Priority: Minor
>
> Randomization can be a more effective techinique than a grid search in 
> finding optimal hyperparameters since min/max points can fall between the 
> grid lines and never be found. Randomisation is not so restricted although 
> the probability of finding minima/maxima is dependent on the number of 
> attempts.
> Alice Zheng has an accessible description on how this technique works at 
> [https://www.oreilly.com/library/view/evaluating-machine-learning/9781492048756/ch04.html]
> (Note that I have a PR for this work outstanding at 
> [https://github.com/apache/spark/pull/31535] )
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to