# Machine Learning

**URL:** https://discourse.julialang.org/c/domain/ml/24.md?page=4

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 5

---

## [DimensionMismatch with MLJ](https://discourse.julialang.org/t/dimensionmismatch-with-mlj/125905)

<div class="topic-metadata">

**Author:** [@LucasMSpereira](https://discourse.julialang.org/u/LucasMSpereira)\
**Replies:** 0\
**Last updated:** [February 14, 2025, 1:17pm UTC](https://discourse.julialang.org/t/dimensionmismatch-with-mlj/125905 "2025-02-14T13:17:16Z")

</div>

I’m trying to use MultitargetLinearRegressor in MLJ.jl. This is the mwe: using MLJ, DataFrames multiLinReg = @load MultitargetLinearRegressor pkg = MultivariateStats # data inputs = DataFrame(rand(136, 11), :auto) prepa…

---

## [RAGTools (from PromptingTools.jl) – Seeking Your Feedback on Next Steps](https://discourse.julialang.org/t/ragtools-from-promptingtools-jl-seeking-your-feedback-on-next-steps/125005)

<div class="topic-metadata">

**Author:** [@svilupp](https://discourse.julialang.org/u/svilupp)\
**Replies:** 8\
**Last updated:** [February 9, 2025, 11:26am UTC](https://discourse.julialang.org/t/ragtools-from-promptingtools-jl-seeking-your-feedback-on-next-steps/125005 "2025-02-09T11:26:49Z")

</div>

Introduction & Audience Hello everyone! I’d like to open this thread to gather real-world feedback on the RAGTools experimental submodule currently included in PromptingTools.jl. Specifically, this is for people who have…

---

## [Save model when training with Distributed Data Parallel](https://discourse.julialang.org/t/save-model-when-training-with-distributed-data-parallel/125790)

<div class="topic-metadata">

**Author:** [@niltsz](https://discourse.julialang.org/u/niltsz)\
**Replies:** 0\
**Last updated:** [February 11, 2025, 1:24pm UTC](https://discourse.julialang.org/t/save-model-when-training-with-distributed-data-parallel/125790 "2025-02-11T13:24:45Z")

</div>

Hey all, I want to parallelize my machine learning model on GPUs using DDP from Flux. I get the code to run with adapting what is written on the Flux GPU Support page, but when I try to save the model I get the error u…

---

## [Custom loss functions in \`Lux.jl\`](https://discourse.julialang.org/t/custom-loss-functions-in-lux-jl/125661)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 5\
**Last updated:** [February 10, 2025, 4:28pm UTC](https://discourse.julialang.org/t/custom-loss-functions-in-lux-jl/125661 "2025-02-10T16:28:29Z")

</div>

I am currently getting accustomed to the Lux.jl package. I want to use a custom loss function which includes a l\_2-regression term consisting of the model weights. I defined my custom loss function as function loss\_func…

---

## [Lux.jl QuickStart: why \`Lux.apply\` returns the state?](https://discourse.julialang.org/t/lux-jl-quickstart-why-lux-apply-returns-the-state/125607)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 1\
**Last updated:** [February 6, 2025, 9:55am UTC](https://discourse.julialang.org/t/lux-jl-quickstart-why-lux-apply-returns-the-state/125607 "2025-02-06T09:55:10Z")

</div>

In the QuickStart section of Lux.jl documentation, there is the line y, st = Lux.apply(model, x, ps, st) Why does Lux.apply return not only y but also st? How can inference computations change the neural network state?…

---

## [Creating Parametric ReLU in Flux](https://discourse.julialang.org/t/creating-parametric-relu-in-flux/10987)

<div class="topic-metadata">

**Author:** [@Azamat](https://discourse.julialang.org/u/Azamat)\
**Replies:** 8\
**Last updated:** [February 1, 2025, 6:19pm UTC](https://discourse.julialang.org/t/creating-parametric-relu-in-flux/10987 "2025-02-01T18:19:48Z")

</div>

I would like to create Parametric ReLU (PReLU), an activation function, that is described in \[1502.01852\] Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification I know I should use u…

---

## [Gradient not being computed when training NN using Flux](https://discourse.julialang.org/t/gradient-not-being-computed-when-training-nn-using-flux/125368)

<div class="topic-metadata">

**Author:** [@azeredo-e](https://discourse.julialang.org/u/azeredo-e)\
**Replies:** 3\
**Last updated:** [January 30, 2025, 5:07pm UTC](https://discourse.julialang.org/t/gradient-not-being-computed-when-training-nn-using-flux/125368 "2025-01-30T17:07:23Z")

</div>

Hello Everyone, I’m new to Flux and I’m following the course on book.sciml.ai, right now I’m in lesson three, specifically where is discussed modelling Hooke’s Law and the construction of a PINN, and I’m havong trouble t…

---

## [Can Julia implement experiment animations similar to those in OpenAI Gym?](https://discourse.julialang.org/t/can-julia-implement-experiment-animations-similar-to-those-in-openai-gym/99426)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 12\
**Last updated:** [January 28, 2025, 11:39am UTC](https://discourse.julialang.org/t/can-julia-implement-experiment-animations-similar-to-those-in-openai-gym/99426 "2025-01-28T11:39:01Z")

</div>

When doing reinforcement learning tasks, OpenAI Gym is commonly used for experimentation, for example, solving classic problems such as Cart Pole and Pendulum. While ReinforcementLearning.jl also has built-in environment…

---

## [Reinforcement learning packages for CartPole example with Julia v1.11 or v1.10?](https://discourse.julialang.org/t/reinforcement-learning-packages-for-cartpole-example-with-julia-v1-11-or-v1-10/125261)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [January 28, 2025, 11:10am UTC](https://discourse.julialang.org/t/reinforcement-learning-packages-for-cartpole-example-with-julia-v1-11-or-v1-10/125261 "2025-01-28T11:10:16Z")

</div>

I’ve been looking at reinforcement learning packages in Julia. Some of them are unfortunately slightly out of maintenance and have broken dependencies. Does anyone have a fully working CartPole training example (a well k…

---

## [Batched gradients and hessians with Flux](https://discourse.julialang.org/t/batched-gradients-and-hessians-with-flux/125130)

<div class="topic-metadata">

**Author:** [@Gattu\_Mytraya](https://discourse.julialang.org/u/Gattu_Mytraya)\
**Replies:** 10\
**Last updated:** [January 25, 2025, 10:55pm UTC](https://discourse.julialang.org/t/batched-gradients-and-hessians-with-flux/125130 "2025-01-25T22:55:35Z")

</div>

Hi, I am new to Flux, so I am not sure how to do the following. Say I have some model(params, x) where the model returns an A dimensional output, there are B params, and x is a C dimensional input. I have D inputs su…

---

## [Learning Machine Learning (SVM) with Julia](https://discourse.julialang.org/t/learning-machine-learning-svm-with-julia/36083)

<div class="topic-metadata">

**Author:** [@Fred](https://discourse.julialang.org/u/Fred)\
**Replies:** 10\
**Last updated:** [March 18, 2020, 4:38pm UTC](https://discourse.julialang.org/t/learning-machine-learning-svm-with-julia/36083 "2020-03-18T16:38:42Z")

</div>

Hi ! I would like to learn machine learning, SVM in particular. I am a complete newbie and I search few advices from experimented user before starting. 1- Is it a good idea to learn SVM with Julia or it will be much mo…

---

## [Virtual (or lazy) representation of a repeated array](https://discourse.julialang.org/t/virtual-or-lazy-representation-of-a-repeated-array/124954)

<div class="topic-metadata">

**Author:** [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Replies:** 4\
**Last updated:** [January 22, 2025, 12:22pm UTC](https://discourse.julialang.org/t/virtual-or-lazy-representation-of-a-repeated-array/124954 "2025-01-22T12:22:50Z")

</div>

Is there an array type, that allows me to create a virtual (or lazy) representation of the following array x ? sz = (64, 64, 2, 10589) tmp = reshape(range(-1,1,64),(:,1,1,1)); x = repeat(tmp,1,sz\[2\],sz\[3\],sz\[4\]); It …

---

## [Automatic Differentiation (AD) in Julia vs. Python (or PyTorch)](https://discourse.julialang.org/t/automatic-differentiation-ad-in-julia-vs-python-or-pytorch/124553)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 14\
**Last updated:** [January 16, 2025, 11:52am UTC](https://discourse.julialang.org/t/automatic-differentiation-ad-in-julia-vs-python-or-pytorch/124553 "2025-01-16T11:52:55Z")

</div>

(I find that there were related discussions already: Automatic Differentiation (AD) in Python compared to Julia and AD Basics Automatic differentiation - Julia implementation advantages. But they were at least 4 years…

---

## [Choosing a convention for complex numbers in DifferentiationInterface](https://discourse.julialang.org/t/choosing-a-convention-for-complex-numbers-in-differentiationinterface/124433)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 3\
**Last updated:** [January 7, 2025, 8:46am UTC](https://discourse.julialang.org/t/choosing-a-convention-for-complex-numbers-in-differentiationinterface/124433 "2025-01-07T08:46:17Z")

</div>

Hi everyone, As DifferentiationInterface.jl gains more traction, I find myself forced to confront the issue of AD with complex numbers. Right now they are not officially supported, but they should be and I wonder what t…

---

## [Second order gradient with Lux, Zygote, CUDA, Enzyme](https://discourse.julialang.org/t/second-order-gradient-with-lux-zygote-cuda-enzyme/124301)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 12\
**Last updated:** [January 2, 2025, 2:48pm UTC](https://discourse.julialang.org/t/second-order-gradient-with-lux-zygote-cuda-enzyme/124301 "2025-01-02T14:48:04Z")

</div>

Dear All, I had a small pet project over the christmas, for some very specific application (steganography) I want to train a neural network while regularizing the gradient with respect to the input, which means that dur…

---

## [Scaling issue (probably) while solving simple PINN problem](https://discourse.julialang.org/t/scaling-issue-probably-while-solving-simple-pinn-problem/124183)

<div class="topic-metadata">

**Author:** [@nico](https://discourse.julialang.org/u/nico)\
**Replies:** 3\
**Last updated:** [December 27, 2024, 4:04pm UTC](https://discourse.julialang.org/t/scaling-issue-probably-while-solving-simple-pinn-problem/124183 "2024-12-27T16:04:14Z")

</div>

Hi All! I am trying to solve a simple ODE with the PINN technology. There might be better ways to do that, but I am using it to test and understand few practical things. This code worked perfectly as long as the probl…

---

## [Help using CUDA, Zygote, and random numbers](https://discourse.julialang.org/t/help-using-cuda-zygote-and-random-numbers/123458)

<div class="topic-metadata">

**Author:** [@bgctw](https://discourse.julialang.org/u/bgctw)\
**Replies:** 4\
**Last updated:** [December 23, 2024, 8:59am UTC](https://discourse.julialang.org/t/help-using-cuda-zygote-and-random-numbers/123458 "2024-12-23T08:59:15Z")

</div>

I get the error “llvmcall requires the compiler” when trying to take the gradient of a function that involves generating random numbers in CUDA. Here is a minimal example: using GPUArraysCore: GPUArraysCore using CUDA, …

---

## [Error when compiling gather and scatter operation under Reactant](https://discourse.julialang.org/t/error-when-compiling-gather-and-scatter-operation-under-reactant/123930)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 6\
**Last updated:** [December 19, 2024, 4:57pm UTC](https://discourse.julialang.org/t/error-when-compiling-gather-and-scatter-operation-under-reactant/123930 "2024-12-19T16:57:04Z")

</div>

Hi All, I have started to experiment with Lux, Enzyme, and Reactant. In my applications, I frequently need a operation described as segmented\_sum or segmented\_mean, which can be computed using compositions of scatter a…

---

## [Anyone has an implementation of generic boosting?](https://discourse.julialang.org/t/anyone-has-an-implementation-of-generic-boosting/54729)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 7\
**Last updated:** [December 16, 2024, 1:34pm UTC](https://discourse.julialang.org/t/anyone-has-an-implementation-of-generic-boosting/54729 "2024-12-16T13:34:30Z")

</div>

Dear All, I would like to ask, as the title suggest, if anyone has a general implementation of boosting algorithm? I did some search and found that it is usually tightly coupled with a base learners being decision trees…

---

## [Unable to find \`fit\` in \`CatBoost.MLJCatBoostInterface](https://discourse.julialang.org/t/unable-to-find-fit-in-catboost-mljcatboostinterface/123818)

<div class="topic-metadata">

**Author:** [@julien\_goo](https://discourse.julialang.org/u/julien_goo)\
**Replies:** 4\
**Last updated:** [December 15, 2024, 9:53pm UTC](https://discourse.julialang.org/t/unable-to-find-fit-in-catboost-mljcatboostinterface/123818 "2024-12-15T21:53:32Z")

</div>

Hi! I have developped a ML workflow using MLJ with some data preparation, feature engineer, cross-val and tuning (evaluate! function). Up to now, I used LightGBM (it worked fine), but since I have categorical variables,…

---

## [arXiv: "The State of Julia for Scientific Machine Learning" by Berman & Ginesin](https://discourse.julialang.org/t/arxiv-the-state-of-julia-for-scientific-machine-learning-by-berman-ginesin/121413)

<div class="topic-metadata">

**Author:** [@jonasaugust](https://discourse.julialang.org/u/jonasaugust)\
**Replies:** 29\
**Last updated:** [December 15, 2024, 7:01pm UTC](https://discourse.julialang.org/t/arxiv-the-state-of-julia-for-scientific-machine-learning-by-berman-ginesin/121413 "2024-12-15T19:01:57Z")

</div>

The State of Julia for Scientific Machine Learning A brief survey. Considers why Julia isn’t more popular vs. Python & Jax. Finds calling Julia from other languages difficult.

---

## ["gpu\_device" not defined in DDP with Flux](https://discourse.julialang.org/t/gpu-device-not-defined-in-ddp-with-flux/123857)

<div class="topic-metadata">

**Author:** [@niltsz](https://discourse.julialang.org/u/niltsz)\
**Replies:** 2\
**Last updated:** [December 15, 2024, 5:54pm UTC](https://discourse.julialang.org/t/gpu-device-not-defined-in-ddp-with-flux/123857 "2024-12-15T17:54:37Z")

</div>

Hey everybody, when I try to run the example from the Flux website for data distributed parallel training, I get the error that the gpu\_device is not defined, looking suspiciously familiar to a Lux name. Any suggestions …

---

## [Transfer Learning in Lux?](https://discourse.julialang.org/t/transfer-learning-in-lux/123731)

<div class="topic-metadata">

**Author:** [@rkube](https://discourse.julialang.org/u/rkube)\
**Replies:** 1\
**Last updated:** [December 12, 2024, 2:44am UTC](https://discourse.julialang.org/t/transfer-learning-in-lux/123731 "2024-12-12T02:44:56Z")

</div>

Hi, I would like to transfer learn a regression model onto a classification task. This is my regression model: model = Chain( Conv((32, 16), 1 =\> 8), LayerNorm((129, 77, 8), relu, dims=(1, 2, 3)), Conv((32…

---

## [How to use Lux with Enzyme](https://discourse.julialang.org/t/how-to-use-lux-with-enzyme/122920)

<div class="topic-metadata">

**Author:** [@odddot](https://discourse.julialang.org/u/odddot)\
**Replies:** 6\
**Last updated:** [December 11, 2024, 6:08pm UTC](https://discourse.julialang.org/t/how-to-use-lux-with-enzyme/122920 "2024-12-11T18:08:51Z")

</div>

Hi, I am trying to use Lux with Enzyme, and I cannot get it to work in a simple example. The only complete (and working) example that I have found is this: Compiling Lux Models using Reactant.jl | Lux.jl Docs, which is …

---

## [Cannot differentiate through a multivariate log normal probability density with Zygote](https://discourse.julialang.org/t/cannot-differentiate-through-a-multivariate-log-normal-probability-density-with-zygote/123571)

<div class="topic-metadata">

**Author:** [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Replies:** 4\
**Last updated:** [December 11, 2024, 3:10pm UTC](https://discourse.julialang.org/t/cannot-differentiate-through-a-multivariate-log-normal-probability-density-with-zygote/123571 "2024-12-11T15:10:38Z")

</div>

I’ve built a loss function based on the negative log likelihood of a multivariate log normal distribution. However, when I try to calculate the gradients I hit the following error which I would think stems from the handl…

---

## [\[Flux + Yao\] Variable quantum circuits with trainable parameters](https://discourse.julialang.org/t/flux-yao-variable-quantum-circuits-with-trainable-parameters/123706)

<div class="topic-metadata">

**Author:** [@mbm204](https://discourse.julialang.org/u/mbm204)\
**Replies:** 1\
**Last updated:** [December 11, 2024, 2:46pm UTC](https://discourse.julialang.org/t/flux-yao-variable-quantum-circuits-with-trainable-parameters/123706 "2024-12-11T14:46:07Z")

</div>

I’m doing quantum machine learning in Yao and Flux. The construction of the quantum circuits within Yao is fairly straightforward but contains a gate construction that depends on the number of qubits involved. When setti…

---

## [Basic example for using Transformers.jl for sequential autoencoding](https://discourse.julialang.org/t/basic-example-for-using-transformers-jl-for-sequential-autoencoding/123663)

<div class="topic-metadata">

**Author:** [@spolk](https://discourse.julialang.org/u/spolk)\
**Replies:** 0\
**Last updated:** [December 10, 2024, 3:06pm UTC](https://discourse.julialang.org/t/basic-example-for-using-transformers-jl-for-sequential-autoencoding/123663 "2024-12-10T15:06:19Z")

</div>

I am interested in using Transformers.jl for sequence-to-sequence autoencoding and was hoping to get help solving a minimum working example building and training an appropriate transformer-based sequence-to-sequence aut…

---

## [Sparse loss with Flux](https://discourse.julialang.org/t/sparse-loss-with-flux/123624)

<div class="topic-metadata">

**Author:** [@niltsz](https://discourse.julialang.org/u/niltsz)\
**Replies:** 3\
**Last updated:** [December 9, 2024, 6:24pm UTC](https://discourse.julialang.org/t/sparse-loss-with-flux/123624 "2024-12-09T18:24:49Z")

</div>

Hello, I want to train a Neural network that improves the pixels of an image, but with a sparse loss function, i.e. the true pixel information exists only sparsely, and the positions are different for each training examp…

---

## [SymbolicRegression.jl freezing my terminal when running report](https://discourse.julialang.org/t/symbolicregression-jl-freezing-my-terminal-when-running-report/119368)

<div class="topic-metadata">

**Author:** [@elcup](https://discourse.julialang.org/u/elcup)\
**Replies:** 11\
**Last updated:** [December 9, 2024, 2:19am UTC](https://discourse.julialang.org/t/symbolicregression-jl-freezing-my-terminal-when-running-report/119368 "2024-12-09T02:19:17Z")

</div>

Hey! I am starting to play with SymbolicRegression.jl and I am getting some weird behavior when running the basic example (Examples · SymbolicRegression.jl) To give some context, I am running the following code: using…

---

## [Enzyme Autodiff readonly error and working with batches of data](https://discourse.julialang.org/t/enzyme-autodiff-readonly-error-and-working-with-batches-of-data/123012)

<div class="topic-metadata">

**Author:** [@turiya](https://discourse.julialang.org/u/turiya)\
**Replies:** 14\
**Last updated:** [November 26, 2024, 2:28pm UTC](https://discourse.julialang.org/t/enzyme-autodiff-readonly-error-and-working-with-batches-of-data/123012 "2024-11-26T14:28:35Z")

</div>

I have the following MWE using Enzyme, Lux, Random n = 10 x\_batch = randn(2,n) y\_batch = randn(2,n) model = Chain(Parallel(vcat, Dense(2, 1, tanh), Dense(2,1,tanh)), Dense(2,1,tanh)) rng = Random.default\_rng() Random.se…

[Previous page](https://discourse.julialang.org/c/domain/ml/24.md?page=3)

[Next page](https://discourse.julialang.org/c/domain/ml/24.md?page=5)
