# Machine Learning

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

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

**Page:** 23

---

## [Python porting to Julia resources](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953)

<div class="topic-metadata">

**Author:** [@vphom](https://discourse.julialang.org/u/vphom)\
**Replies:** 28\
**Last updated:** [August 10, 2022, 8:41pm UTC](https://discourse.julialang.org/t/python-porting-to-julia-resources/31953 "2022-08-10T20:41:56Z")

</div>

I’m trying to port an Machine Learning app that was written in Python using Pytorch to Julia and I’m a newbie in Julia. Is there a resource,cheat sheet that show how the same thing work in Julia for examples Python …

---

## [Can Flux handle multiple GPUs?](https://discourse.julialang.org/t/can-flux-handle-multiple-gpus/85323)

<div class="topic-metadata">

**Author:** [@Lewis\_Hein](https://discourse.julialang.org/u/Lewis_Hein)\
**Replies:** 16\
**Last updated:** [August 5, 2022, 10:23pm UTC](https://discourse.julialang.org/t/can-flux-handle-multiple-gpus/85323 "2022-08-05T22:23:09Z")

</div>

I am playing around with ML in Julia and stumbled on a source of cheap nvidia Quadro K2000s. Far from modern, I know, but I can’t afford modern hardware for side projects. If I stuck 4 of them in 1 tower, would Flux/Cuda…

---

## [Neural ODE works for small networks, but throws error for larger networks (getindex() method)?](https://discourse.julialang.org/t/neural-ode-works-for-small-networks-but-throws-error-for-larger-networks-getindex-method/85258)

<div class="topic-metadata">

**Author:** [@jvkoch](https://discourse.julialang.org/u/jvkoch)\
**Replies:** 4\
**Last updated:** [August 4, 2022, 3:06pm UTC](https://discourse.julialang.org/t/neural-ode-works-for-small-networks-but-throws-error-for-larger-networks-getindex-method/85258 "2022-08-04T15:06:42Z")

</div>

Hello all: I’m running into strange behavior with neural ODEs defined with composite functions and FastChain definitions. In short, the below code works w/o issue for small neural networks, but fails for larger networks…

---

## [GPU performance and switching from tabular to recurrent data format for Flux.jl](https://discourse.julialang.org/t/gpu-performance-and-switching-from-tabular-to-recurrent-data-format-for-flux-jl/84969)

<div class="topic-metadata">

**Author:** [@JLDC](https://discourse.julialang.org/u/JLDC)\
**Replies:** 5\
**Last updated:** [August 1, 2022, 6:52am UTC](https://discourse.julialang.org/t/gpu-performance-and-switching-from-tabular-to-recurrent-data-format-for-flux-jl/84969 "2022-08-01T06:52:48Z")

</div>

When training a recurrent network using Flux.jl, a dataset with K features, S samples, and a sequence length of L should take the form of a vector of length L where each element is a K × S matrix. Let’s say that I have …

---

## [Siamese/Twin network in Flux (working with two image inputs)](https://discourse.julialang.org/t/siamese-twin-network-in-flux-working-with-two-image-inputs/84991)

<div class="topic-metadata">

**Author:** [@LetsGrillBananas](https://discourse.julialang.org/u/LetsGrillBananas)\
**Replies:** 2\
**Last updated:** [July 29, 2022, 6:19pm UTC](https://discourse.julialang.org/t/siamese-twin-network-in-flux-working-with-two-image-inputs/84991 "2022-07-29T18:19:36Z")

</div>

I’m trying Flux for the first time, so I’m porting a project I did in PyTorch earlier this year over to Flux. Essentially, the project is to classify plant leaves as healthy or diseased. I already have a baseline transfe…

---

## [\[English\] \`train!\` or \`fit!\` for a ML API?](https://discourse.julialang.org/t/english-train-or-fit-for-a-ml-api/84899)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [July 28, 2022, 11:13pm UTC](https://discourse.julialang.org/t/english-train-or-fit-for-a-ml-api/84899 "2022-07-28T23:13:24Z")

</div>

I am deeply undecided to name the step where parameters of a model are learned from data in the API of my ML library train!(model,X,\[Y\]) or fit!(model,X,\[Y\]). I would intuitively prefer the first, as make somehow explic…

---

## [Flux: can't get recurrent sequence-to-one model to train](https://discourse.julialang.org/t/flux-cant-get-recurrent-sequence-to-one-model-to-train/57459)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 8\
**Last updated:** [July 27, 2022, 1:18pm UTC](https://discourse.julialang.org/t/flux-cant-get-recurrent-sequence-to-one-model-to-train/57459 "2022-07-27T13:18:08Z")

</div>

I am attempting to create a simple recurrent model that takes data generated by a parameterized data generating process as the input, and the parameters of the DGP as the output. The goal is to learn the parameters, give…

---

## [Dimension mismatch in Flux with NeuralODE](https://discourse.julialang.org/t/dimension-mismatch-in-flux-with-neuralode/84804)

<div class="topic-metadata">

**Author:** [@WillT](https://discourse.julialang.org/u/WillT)\
**Replies:** 0\
**Last updated:** [July 26, 2022, 9:52am UTC](https://discourse.julialang.org/t/dimension-mismatch-in-flux-with-neuralode/84804 "2022-07-26T09:52:08Z")

</div>

In Flux I’m trying to chain together a NeuralODE and some other layers. When I evaluate the network and the a loss function, it works ok. But when I try to calculate the gradients of the loss w.r.t. the params there is a…

---

## [ReinforcementLearning.jl weird behavior on custom environment, reset! is in Schrödingers namespace](https://discourse.julialang.org/t/reinforcementlearning-jl-weird-behavior-on-custom-environment-reset-is-in-schrodingers-namespace/84605)

<div class="topic-metadata">

**Author:** [@bileamScheuvens](https://discourse.julialang.org/u/bileamScheuvens)\
**Replies:** 0\
**Last updated:** [July 21, 2022, 8:43pm UTC](https://discourse.julialang.org/t/reinforcementlearning-jl-weird-behavior-on-custom-environment-reset-is-in-schrodingers-namespace/84605 "2022-07-21T20:43:19Z")

</div>

After implementing the RLBase.reset! method for my environment im being told the method doesn’t exist. When checking in help mode, Julia asks whether i meant ‘reset!’ instead of ‘reset!’. Does anyone have a clue where …

---

## [RandomForestRegressor in Julia](https://discourse.julialang.org/t/randomforestregressor-in-julia/84425)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 9\
**Last updated:** [July 21, 2022, 3:30pm UTC](https://discourse.julialang.org/t/randomforestregressor-in-julia/84425 "2022-07-21T15:30:53Z")

</div>

I’m trying to train a RandomForestRegressor using DecisionTree.jl and RandomizedSearchCV (contained in ScikitLearn.jl) in Julia. Primary datasets like x\_train and y\_train etc. are provided in my google drive as well, So…

---

## [Machine Learning Property Loans for Fun and Profit with MLJ.jl](https://discourse.julialang.org/t/machine-learning-property-loans-for-fun-and-profit-with-mlj-jl/84414)

<div class="topic-metadata">

**Author:** [@dm13450](https://discourse.julialang.org/u/dm13450)\
**Replies:** 4\
**Last updated:** [July 19, 2022, 6:29am UTC](https://discourse.julialang.org/t/machine-learning-property-loans-for-fun-and-profit-with-mlj-jl/84414 "2022-07-19T06:29:01Z")

</div>

I’ve written a post about using Julia and MLJ on a dataset of property loans. It was my first time really getting to grips with the MLJ framework and I really liked the one-stop interface for the different models. Th…

---

## [Kmeans clustering using Clustering package](https://discourse.julialang.org/t/kmeans-clustering-using-clustering-package/84391)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 2\
**Last updated:** [July 18, 2022, 12:06pm UTC](https://discourse.julialang.org/t/kmeans-clustering-using-clustering-package/84391 "2022-07-18T12:06:42Z")

</div>

The documentation of kmeans of the Clustering.jl states that: help?\> kmeans search: kmeans kmeans! kmeans\_opts KmeansResult kmeans(X, k, \[...\]) -\> KmeansResult K-means clustering of the d×n data matrix X (each co…

---

## [UDE giving Linear Approximation](https://discourse.julialang.org/t/ude-giving-linear-approximation/84327)

<div class="topic-metadata">

**Author:** [@ccccc](https://discourse.julialang.org/u/ccccc)\
**Replies:** 4\
**Last updated:** [July 18, 2022, 10:40am UTC](https://discourse.julialang.org/t/ude-giving-linear-approximation/84327 "2022-07-18T10:40:49Z")

</div>

I copied the example here: And put in my own function. Everything else is the same except for I didn’t add noise. U = Lux.Chain( Lux.Dense(5,3,rbf), Lux.Dense(3,3, rbf), Lux.Dense(3,3, rbf), Lux.Dense(3,5) ) # Get…

---

## [Slope at a point of RNN using Flux](https://discourse.julialang.org/t/slope-at-a-point-of-rnn-using-flux/84207)

<div class="topic-metadata">

**Author:** [@FrootLoops](https://discourse.julialang.org/u/FrootLoops)\
**Replies:** 1\
**Last updated:** [July 18, 2022, 8:47am UTC](https://discourse.julialang.org/t/slope-at-a-point-of-rnn-using-flux/84207 "2022-07-18T08:47:04Z")

</div>

I am using a recurrent neural network for data of the form (x\_t, y\_t)\_{t=1}^T. My RNN has therefore the form y\_t^{nn} = NN(x\_{t-1}, x\_t, y\_{t-1}), with 1 hidden layer, 20 neurons, a sigmoid activation function and a li…

---

## [MLJ and DiffEqFlux](https://discourse.julialang.org/t/mlj-and-diffeqflux/84259)

<div class="topic-metadata">

**Author:** [@bienpierre](https://discourse.julialang.org/u/bienpierre)\
**Replies:** 1\
**Last updated:** [July 18, 2022, 4:02am UTC](https://discourse.julialang.org/t/mlj-and-diffeqflux/84259 "2022-07-18T04:02:55Z")

</div>

Hello everyone, I would like to know if it is possible to use MLJFlux with DiffEqFlux, or does it exist a interface? Do I have to add method, such as: fit!(loss, penalty, chain::Something\_related\_to\_DiffEqFlux, optimi…

---

## [ReverseDiff - differentiating with respect to some parameters but not others](https://discourse.julialang.org/t/reversediff-differentiating-with-respect-to-some-parameters-but-not-others/84345)

<div class="topic-metadata">

**Author:** [@Nathaniel](https://discourse.julialang.org/u/Nathaniel)\
**Replies:** 6\
**Last updated:** [July 18, 2022, 3:42am UTC](https://discourse.julialang.org/t/reversediff-differentiating-with-respect-to-some-parameters-but-not-others/84345 "2022-07-18T03:42:50Z")

</div>

I’m planning on training some neural networks using ReverseDiff.jl (which I think makes sense because I’ll be training lots of small networks on the CPU), but I have a basic question about how ReverseDiff is intended to …

---

## [Zygote and SDE failure: cannot differentiate through Lux NN](https://discourse.julialang.org/t/zygote-and-sde-failure-cannot-differentiate-through-lux-nn/84177)

<div class="topic-metadata">

**Author:** [@evolbio](https://discourse.julialang.org/u/evolbio)\
**Replies:** 5\
**Last updated:** [July 14, 2022, 10:16pm UTC](https://discourse.julialang.org/t/zygote-and-sde-failure-cannot-differentiate-through-lux-nn/84177 "2022-07-14T22:16:08Z")

</div>

I am optimizing the parameters of a differential equation with a Lux.jl neural network (NN) component, using Optimization.jl. The code for the ODE part is below. This works well when there is no stochasticity, ie, an OD…

---

## [Taking the derivative of a scalar loss, that involves a gradient inside, errors on GPU only](https://discourse.julialang.org/t/taking-the-derivative-of-a-scalar-loss-that-involves-a-gradient-inside-errors-on-gpu-only/80275)

<div class="topic-metadata">

**Author:** [@AlexLewandowski](https://discourse.julialang.org/u/AlexLewandowski)\
**Replies:** 7\
**Last updated:** [July 13, 2022, 5:11am UTC](https://discourse.julialang.org/t/taking-the-derivative-of-a-scalar-loss-that-involves-a-gradient-inside-errors-on-gpu-only/80275 "2022-07-13T05:11:38Z")

</div>

I am working on a meta-learning project and experimenting with MAML. I am able to get a first-order approximation fine, as it can be implemented without differentiating through gradient descent. When doing “full” MAML, I…

---

## [Hypernetworks using Flux.destructure?](https://discourse.julialang.org/t/hypernetworks-using-flux-destructure/77211)

<div class="topic-metadata">

**Author:** [@afishy](https://discourse.julialang.org/u/afishy)\
**Replies:** 10\
**Last updated:** [July 11, 2022, 2:28pm UTC](https://discourse.julialang.org/t/hypernetworks-using-flux-destructure/77211 "2022-07-11T14:28:11Z")

</div>

Flux.destructure provides a nice interface for creating hypernetworks, but I seem to be having trouble with it: it seems to calculate the wrong number of parameters for the dimensions and can’t take the gradient if the h…

---

## [Flux/Lux - Combining two neural networks](https://discourse.julialang.org/t/flux-lux-combining-two-neural-networks/83868)

<div class="topic-metadata">

**Author:** [@raphaelchinchilla](https://discourse.julialang.org/u/raphaelchinchilla)\
**Replies:** 1\
**Last updated:** [July 7, 2022, 1:21am UTC](https://discourse.julialang.org/t/flux-lux-combining-two-neural-networks/83868 "2022-07-07T01:21:51Z")

</div>

I want to design a neural network whose output is the combination of the outputs of two neural networks; a very simple example would be the output of two Dense layers. Intuitively, I would want to write something like m…

---

## [Flux: Obtaining individual layer output for DenseNet from Metalhead.jl](https://discourse.julialang.org/t/flux-obtaining-individual-layer-output-for-densenet-from-metalhead-jl/83830)

<div class="topic-metadata">

**Author:** [@marcpabst](https://discourse.julialang.org/u/marcpabst)\
**Replies:** 2\
**Last updated:** [July 6, 2022, 11:43am UTC](https://discourse.julialang.org/t/flux-obtaining-individual-layer-output-for-densenet-from-metalhead-jl/83830 "2022-07-06T11:43:05Z")

</div>

Hi, I’m training the DenseNet from Metalhead.jl on the CIFAR-10 dataset which generally seems to work quite well. However, I can’t seem to find out how to access the output from individual layers in the Chain. I know a…

---

## [How to "maximize" an unknown categorical function?](https://discourse.julialang.org/t/how-to-maximize-an-unknown-categorical-function/83641)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 8\
**Last updated:** [July 5, 2022, 9:11pm UTC](https://discourse.julialang.org/t/how-to-maximize-an-unknown-categorical-function/83641 "2022-07-05T21:11:05Z")

</div>

Or… How to numerically find the value of a set of variables that produce a given condition? Say I have a problem in which, under certain conditions, something happens. For example, a machine that stops working. O…

---

## [Errors when trying to compute hessian of flux neural net and jacobian of jacobian with zygote](https://discourse.julialang.org/t/errors-when-trying-to-compute-hessian-of-flux-neural-net-and-jacobian-of-jacobian-with-zygote/83631)

<div class="topic-metadata">

**Author:** [@dnajera](https://discourse.julialang.org/u/dnajera)\
**Replies:** 1\
**Last updated:** [July 4, 2022, 8:31pm UTC](https://discourse.julialang.org/t/errors-when-trying-to-compute-hessian-of-flux-neural-net-and-jacobian-of-jacobian-with-zygote/83631 "2022-07-04T20:31:11Z")

</div>

Hi, I’m trying to translate some of my code in Jax over to Julia and running into some errors when trying to use Zygote with Flux neural networks. I have two problems: I get an error when trying to compute the Hessian…

---

## [Sparse jacobians of matrix models](https://discourse.julialang.org/t/sparse-jacobians-of-matrix-models/82537)

<div class="topic-metadata">

**Author:** [@gianmariomanca](https://discourse.julialang.org/u/gianmariomanca)\
**Replies:** 37\
**Last updated:** [July 3, 2022, 6:16pm UTC](https://discourse.julialang.org/t/sparse-jacobians-of-matrix-models/82537 "2022-07-03T18:16:47Z")

</div>

Hi all, I would like to use sparsity to speed up an optimization problem. I have a NxM matrix of data Z and a model m(A) = A - k\*sum(A, dims=2)\*sum(A,dims=1) where A is a matrix of the same dimensions of Z, sum(A, dims…

---

## [Saving and Loading Error BSON.jl](https://discourse.julialang.org/t/saving-and-loading-error-bson-jl/83555)

<div class="topic-metadata">

**Author:** [@ccccc](https://discourse.julialang.org/u/ccccc)\
**Replies:** 4\
**Last updated:** [July 2, 2022, 12:07pm UTC](https://discourse.julialang.org/t/saving-and-loading-error-bson-jl/83555 "2022-07-02T12:07:58Z")

</div>

I’m getting an error while saving / loading in BSON: res1\_node = DiffEqFlux.sciml\_train(loss, p, ADAM(0.01), cb=callback, maxiters = 500) using BSON: @save @save "res1\_node" res1\_node when I try to load: using BSON: …

---

## [Spatial transformer (i.e. GPU-friendly interpolations with gradients) with Flux.jl?](https://discourse.julialang.org/t/spatial-transformer-i-e-gpu-friendly-interpolations-with-gradients-with-flux-jl/70836)

<div class="topic-metadata">

**Author:** [@afishy](https://discourse.julialang.org/u/afishy)\
**Replies:** 7\
**Last updated:** [July 1, 2022, 4:56am UTC](https://discourse.julialang.org/t/spatial-transformer-i-e-gpu-friendly-interpolations-with-gradients-with-flux-jl/70836 "2022-07-01T04:56:17Z")

</div>

Originally posted this on the flux-bridged Slack channel, but thought this might be a good place to post. I need a spatial transformer or something equivalent for a project, written so far entirely in Julia. I thought In…

---

## [Looking for collaborators - implementing SLIDE in julia](https://discourse.julialang.org/t/looking-for-collaborators-implementing-slide-in-julia/83482)

<div class="topic-metadata">

**Author:** [@RickDW](https://discourse.julialang.org/u/RickDW)\
**Replies:** 12\
**Last updated:** [June 29, 2022, 8:39pm UTC](https://discourse.julialang.org/t/looking-for-collaborators-implementing-slide-in-julia/83482 "2022-06-29T20:39:35Z")

</div>

Hi everyone, a while back I had a quick discussion with @outlace (over here) about implementing SLIDE. The basic idea is that you don’t need expensive GPUs or other hardware accelerators to train neural nets. All you nee…

---

## [Pytorch clamp method in Julia?](https://discourse.julialang.org/t/pytorch-clamp-method-in-julia/83393)

<div class="topic-metadata">

**Author:** [@extremety1989](https://discourse.julialang.org/u/extremety1989)\
**Replies:** 4\
**Last updated:** [June 27, 2022, 4:15pm UTC](https://discourse.julialang.org/t/pytorch-clamp-method-in-julia/83393 "2022-06-27T16:15:55Z")

</div>

torch.clamp\_(out, 0.0, 1.0) in Julia ?

---

## [Looking for pytorch method alternative in flux](https://discourse.julialang.org/t/looking-for-pytorch-method-alternative-in-flux/83360)

<div class="topic-metadata">

**Author:** [@extremety1989](https://discourse.julialang.org/u/extremety1989)\
**Replies:** 5\
**Last updated:** [June 26, 2022, 4:56pm UTC](https://discourse.julialang.org/t/looking-for-pytorch-method-alternative-in-flux/83360 "2022-06-26T16:56:40Z")

</div>

i am looking for pytorch’s interpolate(out, scale\_factor=2, mode=“nearest”) torch.nn.functional.interpolate — PyTorch 1.12 documentation method alternative in Flux

---

## [Attempting to reimplement SRGAN from Pytorch to Flux, any help appreciated](https://discourse.julialang.org/t/attempting-to-reimplement-srgan-from-pytorch-to-flux-any-help-appreciated/66869)

<div class="topic-metadata">

**Author:** [@extremety1989](https://discourse.julialang.org/u/extremety1989)\
**Replies:** 4\
**Last updated:** [June 26, 2022, 7:47am UTC](https://discourse.julialang.org/t/attempting-to-reimplement-srgan-from-pytorch-to-flux-any-help-appreciated/66869 "2022-06-26T07:47:42Z")

</div>

Pytorch: class ConvBlock(nn.Module): def \_\_init\_\_( self, in\_channels, out\_channels, discriminator=False, use\_act=True, use\_bn=True, \*\*kwargs, ): su…

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

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