# Machine Learning

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

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

**Page:** 26

---

## [How to train Flux to learn a sequence conditional to some initial "seeds"?](https://discourse.julialang.org/t/how-to-train-flux-to-learn-a-sequence-conditional-to-some-initial-seeds/78330)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 4\
**Last updated:** [April 2, 2022, 7:15pm UTC](https://discourse.julialang.org/t/how-to-train-flux-to-learn-a-sequence-conditional-to-some-initial-seeds/78330 "2022-04-02T19:15:35Z")

</div>

I am trying to write a RNN that given an initial “seed” sequence, it reproduces the continuation of the sequence. In the code above dummy sequences are generated as function of these initial seed points and a RNN approa…

---

## [Join / Append dataLoaders structures](https://discourse.julialang.org/t/join-append-dataloaders-structures/78873)

<div class="topic-metadata">

**Author:** [@lgmendes](https://discourse.julialang.org/u/lgmendes)\
**Replies:** 3\
**Last updated:** [April 2, 2022, 4:55pm UTC](https://discourse.julialang.org/t/join-append-dataloaders-structures/78873 "2022-04-02T16:55:54Z")

</div>

Hi all, How can I add / join /append two dataLoaders structures ?

---

## [Resources for Distributed Training w/ Flux](https://discourse.julialang.org/t/resources-for-distributed-training-w-flux/78105)

<div class="topic-metadata">

**Author:** [@austinbean](https://discourse.julialang.org/u/austinbean)\
**Replies:** 1\
**Last updated:** [April 2, 2022, 5:07am UTC](https://discourse.julialang.org/t/resources-for-distributed-training-w-flux/78105 "2022-04-02T05:07:39Z")

</div>

Hello - Is there a current (c. 2022) guide to parallel / distributed training in Flux, especially on GPUs? I found this archived repo but if there’s anything more current or if anyone has done this recently, I’d love …

---

## [Zygote.jl: @adjoint! (mutating / inplace adjoints)](https://discourse.julialang.org/t/zygote-jl-adjoint-mutating-inplace-adjoints/78241)

<div class="topic-metadata">

**Author:** [@MaximilianGelbrecht](https://discourse.julialang.org/u/MaximilianGelbrecht)\
**Replies:** 1\
**Last updated:** [April 2, 2022, 5:05am UTC](https://discourse.julialang.org/t/zygote-jl-adjoint-mutating-inplace-adjoints/78241 "2022-04-02T05:05:13Z")

</div>

Inspecting the Zygote code, I can see that aside from @adjoint there is also @adjoint! that is used to declare the adjoints of some mutating functions (like push! etc). I can’t find any doc strings or documentation when …

---

## [Understanding an error in a reverse call of DiffEqFlux.sciml\_train](https://discourse.julialang.org/t/understanding-an-error-in-a-reverse-call-of-diffeqflux-sciml-train/78680)

<div class="topic-metadata">

**Author:** [@linkz](https://discourse.julialang.org/u/linkz)\
**Replies:** 1\
**Last updated:** [March 30, 2022, 4:40pm UTC](https://discourse.julialang.org/t/understanding-an-error-in-a-reverse-call-of-diffeqflux-sciml-train/78680 "2022-03-30T16:40:43Z")

</div>

I am trying to train a custom, quite complex model, am getting the following error during the reverse call to calculate gradients (using DiffEqFlux.sciml\_train for optimization) and I struggle to understand what it means…

---

## [Poisson Equation example of NeuralPDE.jl throws hash error](https://discourse.julialang.org/t/poisson-equation-example-of-neuralpde-jl-throws-hash-error/78071)

<div class="topic-metadata">

**Author:** [@FrootLoops](https://discourse.julialang.org/u/FrootLoops)\
**Replies:** 17\
**Last updated:** [March 29, 2022, 1:24pm UTC](https://discourse.julialang.org/t/poisson-equation-example-of-neuralpde-jl-throws-hash-error/78071 "2022-03-29T13:24:21Z")

</div>

I am new to the PINN topic and therefore I just wanted to study through the tutorial of NeuralPDE.jl. I tried several examples from the tutorial. Sadly none of it works and I get the same error for each example. I am us…

---

## [How to visualise the structure of the decision tree built by MLJ?](https://discourse.julialang.org/t/how-to-visualise-the-structure-of-the-decision-tree-built-by-mlj/30946)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 9\
**Last updated:** [March 27, 2022, 6:42pm UTC](https://discourse.julialang.org/t/how-to-visualise-the-structure-of-the-decision-tree-built-by-mlj/30946 "2022-03-27T18:42:08Z")

</div>

using RDatasets, DataFrames iris = dataset("datasets", "iris") using MLJ # using the MLJ framework using MLJModels # loads the modesl MLJ can use e.g. linear regression, decision tree tree\_model = @load DecisionTreeClas…

---

## [Flux vs Knet for research and production](https://discourse.julialang.org/t/flux-vs-knet-for-research-and-production/78449)

<div class="topic-metadata">

**Author:** [@matic\_lauko](https://discourse.julialang.org/u/matic_lauko)\
**Replies:** 8\
**Last updated:** [March 27, 2022, 4:01pm UTC](https://discourse.julialang.org/t/flux-vs-knet-for-research-and-production/78449 "2022-03-27T16:01:26Z")

</div>

I’m new to AI in julia, and to AI in general, but still want to make the best decision or at least know the reason for choice. What are the advantages and disadvantages of both packages for production and also research. …

---

## [How to obtain the gradients of intermediate variables with Flux](https://discourse.julialang.org/t/how-to-obtain-the-gradients-of-intermediate-variables-with-flux/55913)

<div class="topic-metadata">

**Author:** [@AquaIndigo](https://discourse.julialang.org/u/AquaIndigo)\
**Replies:** 11\
**Last updated:** [March 24, 2022, 1:24pm UTC](https://discourse.julialang.org/t/how-to-obtain-the-gradients-of-intermediate-variables-with-flux/55913 "2022-03-24T13:24:22Z")

</div>

Hi, I would like to get the gradients of the outputs of some hidden layer. For example,y = 5x, z = y / 4 and I want to obtain \\frac{\\partial z}{\\partial y}, but y is the intermediate output of an NN. So how can I do tha…

---

## [DeepLearning Visualization / interpretation methods](https://discourse.julialang.org/t/deeplearning-visualization-interpretation-methods/78334)

<div class="topic-metadata">

**Author:** [@lgmendes](https://discourse.julialang.org/u/lgmendes)\
**Replies:** 0\
**Last updated:** [March 23, 2022, 2:26pm UTC](https://discourse.julialang.org/t/deeplearning-visualization-interpretation-methods/78334 "2022-03-23T14:26:13Z")

</div>

Hi, Does anyone know if there is any implementation of GradCam and or other Visualization techniques of DeepLearning models? I found an old package that does not work with the Flux+Zygote ( https://github.com/avik-pal/…

---

## [RNN Sentiment analysis example with Flux: how to use batch ? which value for the inner state?](https://discourse.julialang.org/t/rnn-sentiment-analysis-example-with-flux-how-to-use-batch-which-value-for-the-inner-state/78224)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 0\
**Last updated:** [March 21, 2022, 4:05pm UTC](https://discourse.julialang.org/t/rnn-sentiment-analysis-example-with-flux-how-to-use-batch-which-value-for-the-inner-state/78224 "2022-03-21T16:05:42Z")

</div>

Hello, the code belows model a RNN for sentiment analysis over Amazon reviews. My main problem is that I don’t know how to batch a recursive cell when the sequence (i.e. the review text) has variable length. In the \[do…

---

## [Continual learning in xgboost](https://discourse.julialang.org/t/continual-learning-in-xgboost/78163)

<div class="topic-metadata">

**Author:** [@roh\_codeur](https://discourse.julialang.org/u/roh_codeur)\
**Replies:** 0\
**Last updated:** [March 20, 2022, 2:17pm UTC](https://discourse.julialang.org/t/continual-learning-in-xgboost/78163 "2022-03-20T14:17:53Z")

</div>

Hi I am planning on using continual learning in XGboost. In python, it would work as below: https://xgboost.readthedocs.io/en/latest/python/python\_api.html#xgboost.XGBRegressor.fit https://stackoverflow.com/questions/…

---

## [Isolation Forests?](https://discourse.julialang.org/t/isolation-forests/77859)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 5\
**Last updated:** [March 19, 2022, 8:51pm UTC](https://discourse.julialang.org/t/isolation-forests/77859 "2022-03-19T20:51:30Z")

</div>

Has anyone found or implemented a routine for Isolation Forests in Julia? Thanks in advance.

---

## [BSON error when loading Flux model](https://discourse.julialang.org/t/bson-error-when-loading-flux-model/78085)

<div class="topic-metadata">

**Author:** [@luciano-drozda](https://discourse.julialang.org/u/luciano-drozda)\
**Replies:** 7\
**Last updated:** [March 19, 2022, 4:53pm UTC](https://discourse.julialang.org/t/bson-error-when-loading-flux-model/78085 "2022-03-19T16:53:42Z")

</div>

The command m = BSON.load("model.bson", @\_\_MODULE\_\_)\[:m\] is throwing ERROR: MethodError: Cannot \`convert\` an object of type CuContext to an object of type CuPtr{Nothing} Closest candidates are: convert(::Type{CuPtr{…

---

## [Flux LayerNorm slower than pytorch?](https://discourse.julialang.org/t/flux-layernorm-slower-than-pytorch/78084)

<div class="topic-metadata">

**Author:** [@gpucce](https://discourse.julialang.org/u/gpucce)\
**Replies:** 10\
**Last updated:** [March 18, 2022, 10:46pm UTC](https://discourse.julialang.org/t/flux-layernorm-slower-than-pytorch/78084 "2022-03-18T22:46:38Z")

</div>

I closed a similar topic I opened about one hour ago by mistake, here I try again with clearer example, the issue is that the same LayerNorm layer in pytorch and Flux has large difference in performance and I don’t know …

---

## [Spherical Cap in Julia](https://discourse.julialang.org/t/spherical-cap-in-julia/78027)

<div class="topic-metadata">

**Author:** [@OliveiraIgor](https://discourse.julialang.org/u/OliveiraIgor)\
**Replies:** 3\
**Last updated:** [March 18, 2022, 4:31pm UTC](https://discourse.julialang.org/t/spherical-cap-in-julia/78027 "2022-03-18T16:31:53Z")

</div>

I need to use a set of points from a spherical cap to apply KPCA in Julia, but I don’t know how to create these caps, which idea should I use for this application?

---

## [Calculate specificity (true negative rate) in crossvalidation in AutoMLPipeline](https://discourse.julialang.org/t/calculate-specificity-true-negative-rate-in-crossvalidation-in-automlpipeline/77958)

<div class="topic-metadata">

**Author:** [@Michele\_Avanzo](https://discourse.julialang.org/u/Michele_Avanzo)\
**Replies:** 0\
**Last updated:** [March 16, 2022, 10:21am UTC](https://discourse.julialang.org/t/calculate-specificity-true-negative-rate-in-crossvalidation-in-automlpipeline/77958 "2022-03-16T10:21:08Z")

</div>

Hi all, I am used to calculate sensitivity and specificity in classification problems. Sensitivity is recall, so not a problem, but specificity (true negative) is usually not included in evaluation metrics. Is it possi…

---

## [How to record loss during training with Flux.jl?](https://discourse.julialang.org/t/how-to-record-loss-during-training-with-flux-jl/77877)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 1\
**Last updated:** [March 14, 2022, 4:35pm UTC](https://discourse.julialang.org/t/how-to-record-loss-during-training-with-flux-jl/77877 "2022-03-14T16:35:05Z")

</div>

I want to record the training-loss, along with the test-loss, during a training process. I have to compute the test-loss seperatly from the training process, but I am thinking that I should be able to hook into the train…

---

## [Random access to rows of a table](https://discourse.julialang.org/t/random-access-to-rows-of-a-table/77386)

<div class="topic-metadata">

**Author:** [@ablaom](https://discourse.julialang.org/u/ablaom)\
**Replies:** 27\
**Last updated:** [March 14, 2022, 2:06pm UTC](https://discourse.julialang.org/t/random-access-to-rows-of-a-table/77386 "2022-03-14T14:06:59Z")

</div>

I’d like to see certain enhancements to the tabular data ecosystem, and this post is an appeal to maintainers of table-providing packages (eg, DataFrames) to articulate the form they should like these to take, or give ot…

---

## [How choose which GPU to send the workload to in Flux.jl?](https://discourse.julialang.org/t/how-choose-which-gpu-to-send-the-workload-to-in-flux-jl/16337)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 3\
**Last updated:** [March 11, 2022, 4:14pm UTC](https://discourse.julialang.org/t/how-choose-which-gpu-to-send-the-workload-to-in-flux-jl/16337 "2022-03-11T16:14:15Z")

</div>

I have set up a neural network in Flux and I would like to train it on a GPU. HOwever my laptop has two GPUs and one is an onboard GPU so I like to send the workload to the better GPU. But how I choose which GPU to send…

---

## [How to use Flux.stop()](https://discourse.julialang.org/t/how-to-use-flux-stop/77746)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 1\
**Last updated:** [March 11, 2022, 2:14pm UTC](https://discourse.julialang.org/t/how-to-use-flux-stop/77746 "2022-03-11T14:14:54Z")

</div>

I am trying to learn how to use Flux.stop() in a callback. My problem is that as far as I can tell, my call to Flux.stop() has litterally no effect - see the following example: The setup: using Flux x\_train = randn(Flo…

---

## [Flux. Pooling followed by Dense](https://discourse.julialang.org/t/flux-pooling-followed-by-dense/77394)

<div class="topic-metadata">

**Author:** [@Emmanuel-R8](https://discourse.julialang.org/u/Emmanuel-R8)\
**Replies:** 10\
**Last updated:** [March 9, 2022, 2:44am UTC](https://discourse.julialang.org/t/flux-pooling-followed-by-dense/77394 "2022-03-09T02:44:28Z")

</div>

I am at a loss about the following. I am building a small 2D network where the last 2 layers are a MaxPool followed by a Dense. The parameters to create MaxPool do not care about the size of the input. But the Dense just…

---

## [Scalar indexing error when loading MNIST](https://discourse.julialang.org/t/scalar-indexing-error-when-loading-mnist/77496)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 2\
**Last updated:** [March 8, 2022, 5:37pm UTC](https://discourse.julialang.org/t/scalar-indexing-error-when-loading-mnist/77496 "2022-03-08T17:37:14Z")

</div>

The following code in a fresh session produces a scalar indexing error: using Flux using MLDatasets categories = 0:9 xtrain, ytrain = MNIST.traindata(Float32) xtest, ytest = MNIST.testdata(Float32) ytrain, ytest = Flu…

---

## [Zygote and TimerOutputs, derivative of timed function](https://discourse.julialang.org/t/zygote-and-timeroutputs-derivative-of-timed-function/44234)

<div class="topic-metadata">

**Author:** [@racinmat](https://discourse.julialang.org/u/racinmat)\
**Replies:** 3\
**Last updated:** [March 7, 2022, 12:45pm UTC](https://discourse.julialang.org/t/zygote-and-timeroutputs-derivative-of-timed-function/44234 "2022-03-07T12:45:00Z")

</div>

Hi, sometimes I want to benchmark my code on my neural networks, especially their forward pass, using TimerOutputs.jl, but I don’t want to comment out all this when calculating gradients. Currently it’s crashing, not b…

---

## [Evaluation time of generic gradient vs gradient at a particular input using Flux.jl](https://discourse.julialang.org/t/evaluation-time-of-generic-gradient-vs-gradient-at-a-particular-input-using-flux-jl/77001)

<div class="topic-metadata">

**Author:** [@Kishore\_Nori](https://discourse.julialang.org/u/Kishore_Nori)\
**Replies:** 4\
**Last updated:** [March 5, 2022, 3:54am UTC](https://discourse.julialang.org/t/evaluation-time-of-generic-gradient-vs-gradient-at-a-particular-input-using-flux-jl/77001 "2022-03-05T03:54:59Z")

</div>

I am beginner in ML coming from the scientific computing field and getting started with Flux.jl for a simple deep learning problem (not very deep actually) with an MLP Neural Network (NN). Like the usual training approac…

---

## [Adjoint for Base.TwicePrecision](https://discourse.julialang.org/t/adjoint-for-base-twiceprecision/77052)

<div class="topic-metadata">

**Author:** [@lxvm](https://discourse.julialang.org/u/lxvm)\
**Replies:** 1\
**Last updated:** [March 4, 2022, 5:03pm UTC](https://discourse.julialang.org/t/adjoint-for-base-twiceprecision/77052 "2022-03-04T17:03:23Z")

</div>

Hello, I would like to define an adjoint for Base.TwicePrecision though I was wondering if it can be done given the following test julia\> using Zygote julia\> gradient(x -\> Float64(sum(map(i -\> i\*Base.TwicePrecision(x)…

---

## [Alternatives to zero-padding conv layers?](https://discourse.julialang.org/t/alternatives-to-zero-padding-conv-layers/73488)

<div class="topic-metadata">

**Author:** [@czexana](https://discourse.julialang.org/u/czexana)\
**Replies:** 3\
**Last updated:** [March 4, 2022, 4:59pm UTC](https://discourse.julialang.org/t/alternatives-to-zero-padding-conv-layers/73488 "2022-03-04T16:59:12Z")

</div>

Is there a way to use same-padding or reflection-padding in Flux convolutional layers, such as NNlib.jl supplies in https://github.com/FluxML/NNlib.jl/blob/master/src/padding.jl, rather than only using zero-padding? I’m…

---

## [Source to practice linear regression problems using Julia](https://discourse.julialang.org/t/source-to-practice-linear-regression-problems-using-julia/77271)

<div class="topic-metadata">

**Author:** [@MS\_PRAGATI](https://discourse.julialang.org/u/MS_PRAGATI)\
**Replies:** 3\
**Last updated:** [March 3, 2022, 1:06am UTC](https://discourse.julialang.org/t/source-to-practice-linear-regression-problems-using-julia/77271 "2022-03-03T01:06:25Z")

</div>

could you provide some sources to study Linear regression problems using Julia programming language?

---

## [LoadError: MethodError: no method matching size(::Pair{Symbol, Any}), when using Flux.loadparams!](https://discourse.julialang.org/t/loaderror-methoderror-no-method-matching-size-pair-symbol-any-when-using-flux-loadparams/69578)

<div class="topic-metadata">

**Author:** [@Maxim\_Lubov](https://discourse.julialang.org/u/Maxim_Lubov)\
**Replies:** 1\
**Last updated:** [February 26, 2022, 8:06pm UTC](https://discourse.julialang.org/t/loaderror-methoderror-no-method-matching-size-pair-symbol-any-when-using-flux-loadparams/69578 "2022-02-26T20:06:50Z")

</div>

I try to use Flux.loadparams! as it is described in the documentation loadparams!, and I get an error: Closest candidates are: size(::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY, LinearAlgebra.QRPivoted}) at C:\\…

---

## [Help with derivatives of matrix functions](https://discourse.julialang.org/t/help-with-derivatives-of-matrix-functions/76437)

<div class="topic-metadata">

**Author:** [@raktim](https://discourse.julialang.org/u/raktim)\
**Replies:** 8\
**Last updated:** [February 25, 2022, 2:02pm UTC](https://discourse.julialang.org/t/help-with-derivatives-of-matrix-functions/76437 "2022-02-25T14:02:39Z")

</div>

Hi I have a matrix function G(x): \\mathbb{R}^n \\mapsto \\mathbb{R}^{n\\times n}, where x\\in\\mathbb{R}^n is a vector, and would like to use AD to compute derivatives \\frac{\\partial^2 G\_{ij}(x)}{\\partial x\_i \\partial x\_j}, w…

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

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