# Machine Learning

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

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

**Page:** 28

---

## [Backpropagating through orthogonal projection operator](https://discourse.julialang.org/t/backpropagating-through-orthogonal-projection-operator/63083)

<div class="topic-metadata">

**Author:** [@rkube](https://discourse.julialang.org/u/rkube)\
**Replies:** 2\
**Last updated:** [January 25, 2022, 5:32pm UTC](https://discourse.julialang.org/t/backpropagating-through-orthogonal-projection-operator/63083 "2022-01-25T17:32:34Z")

</div>

Hi, I have a neural network whose loss functions requires to calculate orthogonal projections onto the output of the network. The code runs fine on the CPU, albeit slow. Porting it to the GPU is difficult and I’m stuck.…

---

## [Missing line from deffeqflux blog post](https://discourse.julialang.org/t/missing-line-from-deffeqflux-blog-post/75141)

<div class="topic-metadata">

**Author:** [@pl-ai](https://discourse.julialang.org/u/pl-ai)\
**Replies:** 1\
**Last updated:** [January 25, 2022, 8:10am UTC](https://discourse.julialang.org/t/missing-line-from-deffeqflux-blog-post/75141 "2022-01-25T08:10:13Z")

</div>

In the blog post linked from the diffeqflux package (DiffEqFlux.jl – A Julia Library for Neural Differential Equations), there is this section down the page: Notice that we are not learning a solution to the ODE. Instea…

---

## [Training Deep Neural Network using Data Parallel?](https://discourse.julialang.org/t/training-deep-neural-network-using-data-parallel/75079)

<div class="topic-metadata">

**Author:** [@rkube](https://discourse.julialang.org/u/rkube)\
**Replies:** 5\
**Last updated:** [January 24, 2022, 9:08pm UTC](https://discourse.julialang.org/t/training-deep-neural-network-using-data-parallel/75079 "2022-01-24T21:08:19Z")

</div>

Hi, I need to train some simpler networks on large datasets and would like to use multiple GPUs for training. Is there a tutorial or writeup on how to do this in Julia? I know about this one in torch: Multi-GPU Examples…

---

## [Zero gradients with Zygote vs correct gradients with ReverseDiff using DiffEqFlux](https://discourse.julialang.org/t/zero-gradients-with-zygote-vs-correct-gradients-with-reversediff-using-diffeqflux/74398)

<div class="topic-metadata">

**Author:** [@JordiBolibar](https://discourse.julialang.org/u/JordiBolibar)\
**Replies:** 4\
**Last updated:** [January 24, 2022, 11:05am UTC](https://discourse.julialang.org/t/zero-gradients-with-zygote-vs-correct-gradients-with-reversediff-using-diffeqflux/74398 "2022-01-24T11:05:07Z")

</div>

I’m having some issues (again) with Zygote trying to differentiate a UDE using DiffEqFlux. I already encountered an error with Zygote gradients with the sqrt function. For this new issue I still haven’t been able to isol…

---

## [Vector of Flux Model Parameters Sharing Underlying Data](https://discourse.julialang.org/t/vector-of-flux-model-parameters-sharing-underlying-data/75091)

<div class="topic-metadata">

**Author:** [@RS-Coop](https://discourse.julialang.org/u/RS-Coop)\
**Replies:** 2\
**Last updated:** [January 24, 2022, 3:12am UTC](https://discourse.julialang.org/t/vector-of-flux-model-parameters-sharing-underlying-data/75091 "2022-01-24T03:12:04Z")

</div>

I am trying to extract the parameters of a Flux model in a single vector such that they share the same underlying data, i.e. making changes to the vector changes the model parameters. The following is based on the Flux.d…

---

## [MLJ KNNRegressor BruteTree broken for predict-- load error brutetree has no field indices...?](https://discourse.julialang.org/t/mlj-knnregressor-brutetree-broken-for-predict-load-error-brutetree-has-no-field-indices/74837)

<div class="topic-metadata">

**Author:** [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Replies:** 4\
**Last updated:** [January 22, 2022, 5:02pm UTC](https://discourse.julialang.org/t/mlj-knnregressor-brutetree-broken-for-predict-load-error-brutetree-has-no-field-indices/74837 "2022-01-22T17:02:51Z")

</div>

Using MLJ’s NearestNeighbors KNNRegressor and attempted to use BruteTree algorithm. Get the following error when attempting to use predict: ERROR: LoadError: type BruteTree has no field indices followed by usual stack t…

---

## [NEAT implementation using FLux](https://discourse.julialang.org/t/neat-implementation-using-flux/74931)

<div class="topic-metadata">

**Author:** [@SanAlphaTau](https://discourse.julialang.org/u/SanAlphaTau)\
**Replies:** 2\
**Last updated:** [January 21, 2022, 10:00am UTC](https://discourse.julialang.org/t/neat-implementation-using-flux/74931 "2022-01-21T10:00:10Z")

</div>

Heya, I am trying to implement a simplified version of the NEAT algorithm in julia for a project. I was just wondering what the best way of mapping my genomes into actual code it. Can I build flux models “neuron by neur…

---

## [Convolutional GRU/LSTM in Flux?](https://discourse.julialang.org/t/convolutional-gru-lstm-in-flux/74770)

<div class="topic-metadata">

**Author:** [@johnbb](https://discourse.julialang.org/u/johnbb)\
**Replies:** 4\
**Last updated:** [January 20, 2022, 8:46pm UTC](https://discourse.julialang.org/t/convolutional-gru-lstm-in-flux/74770 "2022-01-20T20:46:21Z")

</div>

Is there any implementation of (2D) convolutional GRU, LSTM or similar based on Flux? A similar question was raised in Sept. 2020.

---

## [Need some help with FluxOpt](https://discourse.julialang.org/t/need-some-help-with-fluxopt/74904)

<div class="topic-metadata">

**Author:** [@stochastic\_guy](https://discourse.julialang.org/u/stochastic_guy)\
**Replies:** 1\
**Last updated:** [January 20, 2022, 6:59pm UTC](https://discourse.julialang.org/t/need-some-help-with-fluxopt/74904 "2022-01-20T18:59:36Z")

</div>

I am trying to use the FluxOptTools (https://github.com/baggepinnen/FluxOptTools.jl) to train a Flux model using Optim . I followed the example provided in the readme. It is working as intended. But when I slightly chang…

---

## [Zygote terribly slow. What am I doing wrong?](https://discourse.julialang.org/t/zygote-terribly-slow-what-am-i-doing-wrong/74877)

<div class="topic-metadata">

**Author:** [@shiroghost](https://discourse.julialang.org/u/shiroghost)\
**Replies:** 12\
**Last updated:** [January 19, 2022, 10:39pm UTC](https://discourse.julialang.org/t/zygote-terribly-slow-what-am-i-doing-wrong/74877 "2022-01-19T22:39:18Z")

</div>

Hi all, I have been using ReverseDiff.jl for a project for quite some time. Now I have switched to Zygote because I need to determine derivative w.r.t. custom types and this seems straightforward with Zygote (see Evalua…

---

## [Evaluate gradient (backpropagation) on a user defined type](https://discourse.julialang.org/t/evaluate-gradient-backpropagation-on-a-user-defined-type/74434)

<div class="topic-metadata">

**Author:** [@shiroghost](https://discourse.julialang.org/u/shiroghost)\
**Replies:** 4\
**Last updated:** [January 19, 2022, 6:20pm UTC](https://discourse.julialang.org/t/evaluate-gradient-backpropagation-on-a-user-defined-type/74434 "2022-01-19T18:20:02Z")

</div>

Hi all, I have the following problem. Given a function f(x::Vector) I know that I can evaluate the gradient using any AD package (In particular I use ReverseDiff.jl). What I need now is to evaluate the gradient on a cus…

---

## [CatViews with Flux optimize!](https://discourse.julialang.org/t/catviews-with-flux-optimize/74759)

<div class="topic-metadata">

**Author:** [@lineycroc](https://discourse.julialang.org/u/lineycroc)\
**Replies:** 4\
**Last updated:** [January 19, 2022, 3:35pm UTC](https://discourse.julialang.org/t/catviews-with-flux-optimize/74759 "2022-01-19T15:35:08Z")

</div>

Flux’s update!(opt, x, x̄) function errors when x and x̄ are of type CatView with the following message: TypeError: in typeassert, expected Tuple{CatView{1, Float64}, CatView{1, Float64}, Vector{Float64}}, got a value o…

---

## [How to efficiently build AD-compatible matrices line by line](https://discourse.julialang.org/t/how-to-efficiently-build-ad-compatible-matrices-line-by-line/74632)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 17\
**Last updated:** [January 15, 2022, 3:46am UTC](https://discourse.julialang.org/t/how-to-efficiently-build-ad-compatible-matrices-line-by-line/74632 "2022-01-15T03:46:01Z")

</div>

I find myself frequently needing a construct like the following: a = Array{Float32}(undef, 100, 5) for i=1:100 a\[i, :\] = \<a vector\> end which works fine in plain Julia, and is highly efficient, but gives Flux fits …

---

## [Flailing on evaluating batches as matrices of features](https://discourse.julialang.org/t/flailing-on-evaluating-batches-as-matrices-of-features/74446)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 6\
**Last updated:** [January 14, 2022, 4:13pm UTC](https://discourse.julialang.org/t/flailing-on-evaluating-batches-as-matrices-of-features/74446 "2022-01-14T16:13:48Z")

</div>

This is my first significant Flux program, be gentle :wink: I have a model m. It takes two vectors as input (via a Parallel(vcat...) layer), the first of which is a vector of floats and the second is a one-hot. I can ge…

---

## [Import TensorFlow lite model](https://discourse.julialang.org/t/import-tensorflow-lite-model/74572)

<div class="topic-metadata">

**Author:** [@tpoisot](https://discourse.julialang.org/u/tpoisot)\
**Replies:** 0\
**Last updated:** [January 13, 2022, 7:09pm UTC](https://discourse.julialang.org/t/import-tensorflow-lite-model/74572 "2022-01-13T19:09:23Z")

</div>

I have a model that’s available as a .tflite file, and I’d like to retrain it in Julia (preferably using Flux). Is there a standard way of importing a tflite file in Julia?

---

## [LSTM - Scaling training data MinMaxScaler Flux alternative](https://discourse.julialang.org/t/lstm-scaling-training-data-minmaxscaler-flux-alternative/74323)

<div class="topic-metadata">

**Author:** [@Jan\_Svanda](https://discourse.julialang.org/u/Jan_Svanda)\
**Replies:** 2\
**Last updated:** [January 11, 2022, 3:28am UTC](https://discourse.julialang.org/t/lstm-scaling-training-data-minmaxscaler-flux-alternative/74323 "2022-01-11T03:28:37Z")

</div>

I try to build a model of a dynamic system very similar to Using PyTorch based LSTM to model nonlinear dynamic systems using Flux in Julia. I need to scale the train/test date to (-1,1) but I didn’t find a scaling functi…

---

## [Help needed with Zygote Flux and custom adjoints on GPU](https://discourse.julialang.org/t/help-needed-with-zygote-flux-and-custom-adjoints-on-gpu/74326)

<div class="topic-metadata">

**Author:** [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)\
**Replies:** 1\
**Last updated:** [January 11, 2022, 3:27am UTC](https://discourse.julialang.org/t/help-needed-with-zygote-flux-and-custom-adjoints-on-gpu/74326 "2022-01-11T03:27:30Z")

</div>

I am incorporating some simple non-standard elements in a larger DNN. To achieve this I had to manually define some reverse rules through ChainRulesCore syntax ChainRulesCore.rrule(::typeof(f),args...) Which works gre…

---

## [Implementation of composite quantile loss for Flux](https://discourse.julialang.org/t/implementation-of-composite-quantile-loss-for-flux/73978)

<div class="topic-metadata">

**Author:** [@johnbb](https://discourse.julialang.org/u/johnbb)\
**Replies:** 7\
**Last updated:** [January 9, 2022, 10:55pm UTC](https://discourse.julialang.org/t/implementation-of-composite-quantile-loss-for-flux/73978 "2022-01-09T22:55:27Z")

</div>

The composite quantile loss for a set of quantiles can be defined as \\sum\_i \\sum\_ j (p\_j - 1\\{y\_i \< q\_{ji}\\}) (y\_i - q\_{ji}) where p\_j \\in(0,1) denote the j-th quantile level/probability, y\_i the i-th target/observa…

---

## [In MLJ, can I access individual predictions in an \`EnsembleModel\`?](https://discourse.julialang.org/t/in-mlj-can-i-access-individual-predictions-in-an-ensemblemodel/74302)

<div class="topic-metadata">

**Author:** [@ablaom](https://discourse.julialang.org/u/ablaom)\
**Replies:** 1\
**Last updated:** [January 9, 2022, 8:28pm UTC](https://discourse.julialang.org/t/in-mlj-can-i-access-individual-predictions-in-an-ensemblemodel/74302 "2022-01-09T20:28:25Z")

</div>

The question in the title is copied from Slack.

---

## [Function to Calculate Kappa](https://discourse.julialang.org/t/function-to-calculate-kappa/72852)

<div class="topic-metadata">

**Author:** [@Rahul](https://discourse.julialang.org/u/Rahul)\
**Replies:** 5\
**Last updated:** [January 5, 2022, 11:04pm UTC](https://discourse.julialang.org/t/function-to-calculate-kappa/72852 "2022-01-05T23:04:31Z")

</div>

Is there a function to calculate Kappa in MLJ? If no, I wrote a function (shown below) and I am looking for a more efficient implementation. function kappa(predictions, original) # Confusion matrix confmat = ML…

---

## [Flux.jl Restrict Gradients to Non-Zero values in sparse layer](https://discourse.julialang.org/t/flux-jl-restrict-gradients-to-non-zero-values-in-sparse-layer/72124)

<div class="topic-metadata">

**Author:** [@james-a-mcmanus](https://discourse.julialang.org/u/james-a-mcmanus)\
**Replies:** 5\
**Last updated:** [January 5, 2022, 11:07am UTC](https://discourse.julialang.org/t/flux-jl-restrict-gradients-to-non-zero-values-in-sparse-layer/72124 "2022-01-05T11:07:06Z")

</div>

Hi, I’m trying to make a custom network layer with sparse weights. I only want to train the non-zero values of the layer, however when I try to create a gradient from this the gradient returns nothing. Here is a MWE. u…

---

## [MLP - DimensionMisMatch Error Just Before Training](https://discourse.julialang.org/t/mlp-dimensionmismatch-error-just-before-training/74007)

<div class="topic-metadata">

**Author:** [@sherlock\_holmes](https://discourse.julialang.org/u/sherlock_holmes)\
**Replies:** 2\
**Last updated:** [January 3, 2022, 10:57pm UTC](https://discourse.julialang.org/t/mlp-dimensionmismatch-error-just-before-training/74007 "2022-01-03T22:57:21Z")

</div>

Hi, I’m trying to train a MLP model to predict number of real roots of polynomials. x\_train and y\_train include array of arrays such as \[\[-204, 20, 13, 1, 0\]\] which are coefficients of polynomials. x\_test and y\_test incl…

---

## [LSTM with batch vs with individual values](https://discourse.julialang.org/t/lstm-with-batch-vs-with-individual-values/73722)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 4\
**Last updated:** [January 3, 2022, 10:37am UTC](https://discourse.julialang.org/t/lstm-with-batch-vs-with-individual-values/73722 "2022-01-03T10:37:37Z")

</div>

Looks like there are two ways of calling models (running forecasting/regression/etc) in Flux: “batch mode” (model(data\_matrix)) and “vector comprehension mode” (\[model(elem)\[1\] for elem in data\_vector\]), where elem is on…

---

## [Noobish question regarding yhat probabilities](https://discourse.julialang.org/t/noobish-question-regarding-yhat-probabilities/73905)

<div class="topic-metadata">

**Author:** [@AdamWysokinski](https://discourse.julialang.org/u/AdamWysokinski)\
**Replies:** 3\
**Last updated:** [January 2, 2022, 11:26am UTC](https://discourse.julialang.org/t/noobish-question-regarding-yhat-probabilities/73905 "2022-01-02T11:26:00Z")

</div>

Hi, I’ve just started learning MLJ and I’m recreating a RandomForrect-based binary classification that I did in Python/Scikit. The MLJ version works fine, with one major exception.When I put new data through the trained…

---

## [How to efficiently and precisely fit a function with neural networks?](https://discourse.julialang.org/t/how-to-efficiently-and-precisely-fit-a-function-with-neural-networks/73726)

<div class="topic-metadata">

**Author:** [@thorek1](https://discourse.julialang.org/u/thorek1)\
**Replies:** 16\
**Last updated:** [January 1, 2022, 1:50pm UTC](https://discourse.julialang.org/t/how-to-efficiently-and-precisely-fit-a-function-with-neural-networks/73726 "2022-01-01T13:50:36Z")

</div>

Hi, I am trying (and failing in terms of precision) to use neural networks to fit stochastic optimal control problems. Since this problem has many parts and I would like to have 1e-6 precision I went back to something m…

---

## [\`groups\` argument in Flux.Conv : a misunderstanding](https://discourse.julialang.org/t/groups-argument-in-flux-conv-a-misunderstanding/73641)

<div class="topic-metadata">

**Author:** [@sim](https://discourse.julialang.org/u/sim)\
**Replies:** 4\
**Last updated:** [December 27, 2021, 8:50am UTC](https://discourse.julialang.org/t/groups-argument-in-flux-conv-a-misunderstanding/73641 "2021-12-27T08:50:23Z")

</div>

Hello, I want to define a convolutional layer in Flux.jl using the groups option. Ideally, I want to use Conv((1,1), 3=\>3, groups=3). For reference, the Flux.Conv documentation defines this argument as Keyword groups …

---

## [How to define a data-dependent model without using global variables](https://discourse.julialang.org/t/how-to-define-a-data-dependent-model-without-using-global-variables/73584)

<div class="topic-metadata">

**Author:** [@chen2021](https://discourse.julialang.org/u/chen2021)\
**Replies:** 4\
**Last updated:** [December 25, 2021, 4:40am UTC](https://discourse.julialang.org/t/how-to-define-a-data-dependent-model-without-using-global-variables/73584 "2021-12-25T04:40:20Z")

</div>

Hi, I am facing a problem that the network model depends on data. In fact, I am trying to train an iterator to solve $Au=f$，the model performs a single-step iteration u\_next = model(u), hence the model depends on A and f…

---

## [Hessian Vector products in Flux with Zygote](https://discourse.julialang.org/t/hessian-vector-products-in-flux-with-zygote/40242)

<div class="topic-metadata">

**Author:** [@DR59](https://discourse.julialang.org/u/DR59)\
**Replies:** 4\
**Last updated:** [December 22, 2021, 9:29pm UTC](https://discourse.julialang.org/t/hessian-vector-products-in-flux-with-zygote/40242 "2021-12-22T21:29:03Z")

</div>

Hi, I’m trying to update some of my code that uses Flux models and HVPs. With Tracker as the backend (i.e. the old version of Flux), this was possible. I’m unsure how to implement similar functionality with Zygote. Any h…

---

## [Gradient Origin Networks with Zygote/Flux?](https://discourse.julialang.org/t/gradient-origin-networks-with-zygote-flux/73421)

<div class="topic-metadata">

**Author:** [@afishy](https://discourse.julialang.org/u/afishy)\
**Replies:** 1\
**Last updated:** [December 21, 2021, 10:35pm UTC](https://discourse.julialang.org/t/gradient-origin-networks-with-zygote-flux/73421 "2021-12-21T22:35:01Z")

</div>

Hi! I’d like to train an autoencoder according to this paper. Briefly, it requires first taking a gradient step to get an estimate of the latent vector z, and then evaluating the output of the decoder using z. The differ…

---

## [Local edge feature aggregation in GraphNeuralNetworks.jl](https://discourse.julialang.org/t/local-edge-feature-aggregation-in-graphneuralnetworks-jl/73271)

<div class="topic-metadata">

**Author:** [@bad\_at\_math](https://discourse.julialang.org/u/bad_at_math)\
**Replies:** 2\
**Last updated:** [December 21, 2021, 2:10pm UTC](https://discourse.julialang.org/t/local-edge-feature-aggregation-in-graphneuralnetworks-jl/73271 "2021-12-21T14:10:05Z")

</div>

I’m looking at a broad class of graph neural network update operations defined as follows: for each edge \`k\` connecting vertices \`s\` and \`r\` ē\_k = ϕ\_e(concat(v\_s, v\_r, e\_k)) for each node \`i\` v\_{i, e} = Pool({ē…

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

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