# Machine Learning

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

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

**Page:** 36

---

## [GMM as collaborative filering: why it is better than k-nearest neighbours (KNN)?](https://discourse.julialang.org/t/gmm-as-collaborative-filering-why-it-is-better-than-k-nearest-neighbours-knn/59647)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 0\
**Last updated:** [April 20, 2021, 8:29am UTC](https://discourse.julialang.org/t/gmm-as-collaborative-filering-why-it-is-better-than-k-nearest-neighbours-knn/59647 "2021-04-20T08:29:23Z")

</div>

I have this quotes from a MITx Machine Learning course (but these are from my notes, so I am no longer 100% sure they are exactly the lectures words): "There has been many improvements that has been added to this kind o…

---

## [Batch time-series input for RNN](https://discourse.julialang.org/t/batch-time-series-input-for-rnn/59469)

<div class="topic-metadata">

**Author:** [@Sunny](https://discourse.julialang.org/u/Sunny)\
**Replies:** 1\
**Last updated:** [April 17, 2021, 8:07pm UTC](https://discourse.julialang.org/t/batch-time-series-input-for-rnn/59469 "2021-04-17T20:07:49Z")

</div>

How to form and feed a proper batch to feed to RNN? It is possible to apply RNN to batch of one data point time-series inputs: # single sample rnn = RNN(2,3) seq = ones(Float32,(2,10)) rnn(seq) # apply to 10 sample in…

---

## [CAS Best Practices](https://discourse.julialang.org/t/cas-best-practices/58092)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 87\
**Last updated:** [April 16, 2021, 6:41pm UTC](https://discourse.julialang.org/t/cas-best-practices/58092 "2021-04-16T18:41:59Z")

</div>

{@admin, if it makes good sense, please create a domain for all things Symbolically Maths+Logics (Symbolic Solutions? \[your choice\] ) and move this topic there - - thank you} @rfateman @certik @carette What is your pers…

---

## [The difficult task of comparing supervised models](https://discourse.julialang.org/t/the-difficult-task-of-comparing-supervised-models/59148)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [April 16, 2021, 4:27pm UTC](https://discourse.julialang.org/t/the-difficult-task-of-comparing-supervised-models/59148 "2021-04-16T16:27:29Z")

</div>

I read often blogs or even academic articles that compare different machine learning for a specific tasks, ending up of a ranking based on lower MSE or maximum accuracy for example. These comparisons are done by just ap…

---

## [A partition and a crossValidation function over arbitrary number of n-dimensional arrays](https://discourse.julialang.org/t/a-partition-and-a-crossvalidation-function-over-arbitrary-number-of-n-dimensional-arrays/59343)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 0\
**Last updated:** [April 15, 2021, 1:50pm UTC](https://discourse.julialang.org/t/a-partition-and-a-crossvalidation-function-over-arbitrary-number-of-n-dimensional-arrays/59343 "2021-04-15T13:50:15Z")

</div>

Hello, for my own machine learning library, I implemented the following functions to partition and run cross-validation over a m-set of n-dimensional arrays, where one can specify the dimension to partition or run the cr…

---

## [Binary classification with Flux](https://discourse.julialang.org/t/binary-classification-with-flux/54636)

<div class="topic-metadata">

**Author:** [@Tord](https://discourse.julialang.org/u/Tord)\
**Replies:** 8\
**Last updated:** [April 9, 2021, 4:15pm UTC](https://discourse.julialang.org/t/binary-classification-with-flux/54636 "2021-04-09T16:15:14Z")

</div>

I originally asked this question on the Julia slack, but it occurred to me that this could be a better place to ask: I’ve used Flux successfully for regression and multi-label classification in the past, but today I got…

---

## [Flux train all parameters except those equal to 0](https://discourse.julialang.org/t/flux-train-all-parameters-except-those-equal-to-0/55665)

<div class="topic-metadata">

**Author:** [@anon74562486](https://discourse.julialang.org/u/anon74562486)\
**Replies:** 1\
**Last updated:** [April 2, 2021, 7:43pm UTC](https://discourse.julialang.org/t/flux-train-all-parameters-except-those-equal-to-0/55665 "2021-04-02T19:43:53Z")

</div>

I have a neural network model trained on the mnist dataset. If I add to the loss function a l1 regularization term I get many parameters near 0. But if I set manually those parameters to 0 the model performs worse and …

---

## [How are called "transversal" layers in NN?](https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 5\
**Last updated:** [April 2, 2021, 4:53pm UTC](https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305 "2021-04-02T16:53:29Z")

</div>

Hello, how is it known the concept in a neural network of a “transversal” or “cross section” layer ? I can’t find anything relevant with these two words… Its characteristic is that its activation function takes as input…

---

## [How to make a basic classification in flux?](https://discourse.julialang.org/t/how-to-make-a-basic-classification-in-flux/58358)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [April 2, 2021, 10:17am UTC](https://discourse.julialang.org/t/how-to-make-a-basic-classification-in-flux/58358 "2021-04-02T10:17:00Z")

</div>

I am trying to make a basic classification in Flux, but I am obtainining crazy errors. Where am I wrong ? These are my attempts: Version 1: basic of the basic using Random, Flux x = \[0.1 10; 0.13 13; 0.17 17; 0.2 20; …

---

## [Flux Custom Loss Function Not Working Properly](https://discourse.julialang.org/t/flux-custom-loss-function-not-working-properly/58090)

<div class="topic-metadata">

**Author:** [@rmcsqrd](https://discourse.julialang.org/u/rmcsqrd)\
**Replies:** 20\
**Last updated:** [April 2, 2021, 10:09am UTC](https://discourse.julialang.org/t/flux-custom-loss-function-not-working-properly/58090 "2021-04-02T10:09:21Z")

</div>

Hello, I am trying to implement the A3C reinforcement learning algorithm in Flux.jl using a custom loss function described in the algorithm. I am having trouble with my custom loss function - the parameters of my model d…

---

## [Inverse functions using TaylorSeries.jl](https://discourse.julialang.org/t/inverse-functions-using-taylorseries-jl/43382)

<div class="topic-metadata">

**Author:** [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Replies:** 8\
**Last updated:** [April 1, 2021, 11:24pm UTC](https://discourse.julialang.org/t/inverse-functions-using-taylorseries-jl/43382 "2021-04-01T23:24:06Z")

</div>

Hi @ChrisRackauckas and thread, I’m interested in using AD, and so have been something like 90% successful using TaylorSeries.jl to generate the inverse function to almost any general arbitrary function. For example T…

---

## [Error with training decoupled NODEs](https://discourse.julialang.org/t/error-with-training-decoupled-nodes/58311)

<div class="topic-metadata">

**Author:** [@jvkoch](https://discourse.julialang.org/u/jvkoch)\
**Replies:** 1\
**Last updated:** [April 1, 2021, 12:35pm UTC](https://discourse.julialang.org/t/error-with-training-decoupled-nodes/58311 "2021-04-01T12:35:12Z")

</div>

I’m attempting to train two decoupled neural ODEs simultaneously. Although decoupled, these ODEs interact through a coupled loss function (not shown). I have constructed this in two ways: 1) by writing two separate ODEPr…

---

## [How can I feed sequences of different lengths though a RNN and still have it be differentiable in Flux? (Minimal example included)](https://discourse.julialang.org/t/how-can-i-feed-sequences-of-different-lengths-though-a-rnn-and-still-have-it-be-differentiable-in-flux-minimal-example-included/58340)

<div class="topic-metadata">

**Author:** [@DevJac](https://discourse.julialang.org/u/DevJac)\
**Replies:** 0\
**Last updated:** [April 1, 2021, 3:05am UTC](https://discourse.julialang.org/t/how-can-i-feed-sequences-of-different-lengths-though-a-rnn-and-still-have-it-be-differentiable-in-flux-minimal-example-included/58340 "2021-04-01T03:05:34Z")

</div>

I have several matrices of several different lengths. I want to feed these matrices though a RNN using Flux, however, I haven’t been able to do so. Everything I’ve tried either uses a lot of memory during the backward pa…

---

## [To understand neural ODE](https://discourse.julialang.org/t/to-understand-neural-ode/58236)

<div class="topic-metadata">

**Author:** [@vavrines](https://discourse.julialang.org/u/vavrines)\
**Replies:** 5\
**Last updated:** [March 30, 2021, 6:37pm UTC](https://discourse.julialang.org/t/to-understand-neural-ode/58236 "2021-03-30T18:37:42Z")

</div>

I find I still don’t fully understand neural ordinary differential equations. As shown in literature (Lu et al., 2017; Haber and Ruthotto, 2017; Chen el al., 2018), a sequence of transformations h(t+1) = h(t) + f(h,th…

---

## [Training on Simple Loss gives error: No method matching +(::Float64, ::Array{Float64, 2})](https://discourse.julialang.org/t/training-on-simple-loss-gives-error-no-method-matching-float64-array-float64-2/58047)

<div class="topic-metadata">

**Author:** [@kimlaberinto](https://discourse.julialang.org/u/kimlaberinto)\
**Replies:** 8\
**Last updated:** [March 27, 2021, 12:35pm UTC](https://discourse.julialang.org/t/training-on-simple-loss-gives-error-no-method-matching-float64-array-float64-2/58047 "2021-03-27T12:35:20Z")

</div>

Hello everyone! I’m getting a weird error with Flux/DiffEqFlux with a simple loss function when I try to train. I’m not sure why it’s giving me a ERROR: LoadError: MethodError: no method matching +(::Float64, ::Array{Fl…

---

## [Iteration over 10 columns to calculate LinearRegression](https://discourse.julialang.org/t/iteration-over-10-columns-to-calculate-linearregression/58036)

<div class="topic-metadata">

**Author:** [@statspy](https://discourse.julialang.org/u/statspy)\
**Replies:** 4\
**Last updated:** [March 27, 2021, 6:54am UTC](https://discourse.julialang.org/t/iteration-over-10-columns-to-calculate-linearregression/58036 "2021-03-27T06:54:29Z")

</div>

I have a data frame with 10 columns(features) COL0 to COL9 and a column RESP. How do I calculate a LinearRegression Model for each pair COL0 to COL9 ~ RESP? I am expecting to get 10 graphs showing the Model and also a…

---

## [Can you |\> gpu a GraphConv in GeometricFlux.jl?](https://discourse.julialang.org/t/can-you-gpu-a-graphconv-in-geometricflux-jl/57991)

<div class="topic-metadata">

**Author:** [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)\
**Replies:** 0\
**Last updated:** [March 26, 2021, 6:39am UTC](https://discourse.julialang.org/t/can-you-gpu-a-graphconv-in-geometricflux-jl/57991 "2021-03-26T06:39:15Z")

</div>

Dear developers and experts, I am trying to program with Flux.jl for a GNN project. There is a simple question: can I upload a model, form example, GraphConv in GeometricFlux.jl, to GPU via |\> gpu ? I tried this but did…

---

## [Weights are not updated](https://discourse.julialang.org/t/weights-are-not-updated/57730)

<div class="topic-metadata">

**Author:** [@Sunny](https://discourse.julialang.org/u/Sunny)\
**Replies:** 8\
**Last updated:** [March 25, 2021, 3:50pm UTC](https://discourse.julialang.org/t/weights-are-not-updated/57730 "2021-03-25T15:50:30Z")

</div>

I can’t update weights Here is an example struct hess\_nn net re p # Define inner constructor method function hess\_nn(net; p = nothing) \_p, re = Flux.destructure(net) if p === nothin…

---

## [Autograd through loss function with derivatives in](https://discourse.julialang.org/t/autograd-through-loss-function-with-derivatives-in/57864)

<div class="topic-metadata">

**Author:** [@RynoLaubscher](https://discourse.julialang.org/u/RynoLaubscher)\
**Replies:** 1\
**Last updated:** [March 25, 2021, 6:51am UTC](https://discourse.julialang.org/t/autograd-through-loss-function-with-derivatives-in/57864 "2021-03-25T06:51:46Z")

</div>

Hi All, I am relatively new to Julia, coming from a C/C++ & Python background. I am absolutely loving Julia, but I am struggling a bit to build a simple PINN model using Zygote/Flux (and I tried ForwardDiff). I am using …

---

## [Mutate Zygote Gradients with a Custom Mask Before Update?](https://discourse.julialang.org/t/mutate-zygote-gradients-with-a-custom-mask-before-update/57236)

<div class="topic-metadata">

**Author:** [@boltzmannbrain](https://discourse.julialang.org/u/boltzmannbrain)\
**Replies:** 1\
**Last updated:** [March 25, 2021, 5:07am UTC](https://discourse.julialang.org/t/mutate-zygote-gradients-with-a-custom-mask-before-update/57236 "2021-03-25T05:07:50Z")

</div>

I’m new to Flux/Zygote and I’m trying to train a model with dense layers such that the associated weight matrices are lower triangular. It seems like the way to do this is to write a custom train! function and zero the g…

---

## [How to use gradient of neural network as the loss function?](https://discourse.julialang.org/t/how-to-use-gradient-of-neural-network-as-the-loss-function/50569)

<div class="topic-metadata">

**Author:** [@XiaodongMa-MRI](https://discourse.julialang.org/u/XiaodongMa-MRI)\
**Replies:** 13\
**Last updated:** [March 23, 2021, 6:30pm UTC](https://discourse.julialang.org/t/how-to-use-gradient-of-neural-network-as-the-loss-function/50569 "2021-03-23T18:30:15Z")

</div>

Dear all, I want to put the gradient of neural network (i.e., the gradient of NN output w.r.t input) in the loss function. However, it seems that Zygote cannot differentiate that. Here is my code: using Flux using Zygo…

---

## [TextAnalysis 0.7.2 - where to find SentimentAnalyzer()](https://discourse.julialang.org/t/textanalysis-0-7-2-where-to-find-sentimentanalyzer/57612)

<div class="topic-metadata">

**Author:** [@julio.ca2020](https://discourse.julialang.org/u/julio.ca2020)\
**Replies:** 4\
**Last updated:** [March 20, 2021, 7:29pm UTC](https://discourse.julialang.org/t/textanalysis-0-7-2-where-to-find-sentimentanalyzer/57612 "2021-03-20T19:29:53Z")

</div>

In the documentation for TextAnalysis 0.7.2, the function SentimentAnalyzer() is available. I do not find in the code. Where is it? What am I doing wrong? https://juliahub.com/docs/TextAnalysis/5Mwet/0.7.2/features/

---

## [Apply hessian of neural network to array](https://discourse.julialang.org/t/apply-hessian-of-neural-network-to-array/57602)

<div class="topic-metadata">

**Author:** [@Sunny](https://discourse.julialang.org/u/Sunny)\
**Replies:** 2\
**Last updated:** [March 20, 2021, 2:35pm UTC](https://discourse.julialang.org/t/apply-hessian-of-neural-network-to-array/57602 "2021-03-20T14:35:37Z")

</div>

I can simply take a hessian of some function in multiple points hess = x -\> (Zygote.hessian.(x-\>sum(x.^3), x)) hess(rand(2,3)) 2×3 Array{Float64,2}: 2.67795 3.8318 4.9022 0.216379 5.67439 4.96389 But I’m alway…

---

## [Can you solve a NeuralODEMM on GPU?](https://discourse.julialang.org/t/can-you-solve-a-neuralodemm-on-gpu/57480)

<div class="topic-metadata">

**Author:** [@bad\_at\_math](https://discourse.julialang.org/u/bad_at_math)\
**Replies:** 0\
**Last updated:** [March 18, 2021, 3:03pm UTC](https://discourse.julialang.org/t/can-you-solve-a-neuralodemm-on-gpu/57480 "2021-03-18T15:03:01Z")

</div>

I’m trying to solve a neural ODE with a mass matrix using CUDA. Is this possible, or are the required solvers not GPU-compatible? I can define a NeuralODEMM with a CuArray Chain, but I get the error ERROR: LoadError: sca…

---

## [Why does DiffEqFlux.NeuralODEMM require a constraint equation and a mass matrix?](https://discourse.julialang.org/t/why-does-diffeqflux-neuralodemm-require-a-constraint-equation-and-a-mass-matrix/57428)

<div class="topic-metadata">

**Author:** [@bad\_at\_math](https://discourse.julialang.org/u/bad_at_math)\
**Replies:** 3\
**Last updated:** [March 18, 2021, 2:24pm UTC](https://discourse.julialang.org/t/why-does-diffeqflux-neuralodemm-require-a-constraint-equation-and-a-mass-matrix/57428 "2021-03-18T14:24:40Z")

</div>

Hello everyone! I’m looking at the “Enforcing physical constraints via universal differential-algebraic equations” example (https://diffeqflux.sciml.ai/dev/examples/physical\_constraints/), which trains a neural ordinary…

---

## [GeometricFlux.jl - Is there a true variable graph layer?](https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225)

<div class="topic-metadata">

**Author:** [@emsal](https://discourse.julialang.org/u/emsal)\
**Replies:** 5\
**Last updated:** [March 17, 2021, 2:59am UTC](https://discourse.julialang.org/t/geometricflux-jl-is-there-a-true-variable-graph-layer/57225 "2021-03-17T02:59:40Z")

</div>

I’m looking into using https://github.com/yuehhua/GeometricFlux.jl. I notice that as per docs page https://yuehhua.github.io/GeometricFlux.jl/dev/basics/passgraph/, to pass a variable graph you need to define the GCNConv …

---

## [Parallelizing Loss Function](https://discourse.julialang.org/t/parallelizing-loss-function/57035)

<div class="topic-metadata">

**Author:** [@Honza9723](https://discourse.julialang.org/u/Honza9723)\
**Replies:** 4\
**Last updated:** [March 15, 2021, 2:40pm UTC](https://discourse.julialang.org/t/parallelizing-loss-function/57035 "2021-03-15T14:40:51Z")

</div>

Dear All, I would like to ask you for advice regarding how to parallelize the loss function in Flux. Context: I am solving a discounted infinite-horizon optimization problem (in economics). It has three controls (Cs, Ci…

---

## [Is there an reinforcement learning gym like OpenAI provides?](https://discourse.julialang.org/t/is-there-an-reinforcement-learning-gym-like-openai-provides/57132)

<div class="topic-metadata">

**Author:** [@LarkyJulia](https://discourse.julialang.org/u/LarkyJulia)\
**Replies:** 2\
**Last updated:** [March 14, 2021, 5:57pm UTC](https://discourse.julialang.org/t/is-there-an-reinforcement-learning-gym-like-openai-provides/57132 "2021-03-14T17:57:20Z")

</div>

If yes, is it a native Julia library? Thanks.

---

## [Incorrect (implicit) gradients for a custom model in Flux](https://discourse.julialang.org/t/incorrect-implicit-gradients-for-a-custom-model-in-flux/56902)

<div class="topic-metadata">

**Author:** [@arlk](https://discourse.julialang.org/u/arlk)\
**Replies:** 3\
**Last updated:** [March 12, 2021, 10:28pm UTC](https://discourse.julialang.org/t/incorrect-implicit-gradients-for-a-custom-model-in-flux/56902 "2021-03-12T22:28:53Z")

</div>

I’m seeing incorrectly computed gradients when I use a vector of matrices as a model in Flux. The implicit gradients compute to 0 but the structural gradients seem to be computed correctly. MWE: using Flux struct Veco…

---

## [Negative binomial layer](https://discourse.julialang.org/t/negative-binomial-layer/56804)

<div class="topic-metadata">

**Author:** [@lubo](https://discourse.julialang.org/u/lubo)\
**Replies:** 5\
**Last updated:** [March 10, 2021, 10:45am UTC](https://discourse.julialang.org/t/negative-binomial-layer/56804 "2021-03-10T10:45:24Z")

</div>

Hello, I am new to flux and I would appreciate help with implementing custom layer (or maybe custom activation?). Layer is like Dense layer, some inputs and outputs are exactly two neurons: first with NNlib.softplus ac…

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

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