Quantcast
Channel: First steps - JuliaLang
Browsing all 2795 articles
Browse latest View live

Pkg> add results in “no known versions” errors for “Flux” and “Plots”

I am using Julia version 1.5.1 on a Win10 operating system. Trying to add Plots and Flux results in the errors listed below: (@v1.5) pkg> add Plots Resolving package versions... ERROR:...

View Article


Matrix-by-(slice of)vector multiplication with limited allocation

I am trying to multiply a small matrix by a slice of a vector (subvector), i.e., z[3:7] .= A * x[3:7], and it allocates memory for a copy of the slice. A view is a lightweight option, but it still...

View Article


Function Composition and Piping

The following are equivalent based on the docs. Is there a Julian preference or functional reason to choose one over another, or is it just a matter of personal taste? Nesting: g(f(x)) Composition: (g...

View Article

Flux mutating updates?

I am trying to transfer a model from Python into Julia. Each time I compute my loss function I sample the parameters in my model and store them in a struct. Trying to compute gradients of my loss...

View Article

Image may be NSFW.
Clik here to view.

Code time as color in Plots.jl ... How?

Hi, I am plotting a trajectory in the complex plane. If I plot the whole path Plots.jl offers me this: I would like to know which way it went from beginning to end. I know that Plots.jl offers us a...

View Article


How to select half the rows from a DataFrame column and return an array of...

Hi all, I would like to know how one might partition unique string values from one column of the DataFrame © to achieve my goal. using Random, DataFrames C = DataFrame(Team = ["Packers", "Knights",...

View Article

Performance issues?

As a learning project I reimplemented a simple Bayesian NN in julia from scratch (hopefully without mistakes!) Benchmarking vs. my Pytorch code on the same CPU I’m seeing a runtime of +30% (using...

View Article

Understanding how variables are stored

After my epic boxes or labels question, I decided to put those analogies aside for the moment and focus on the documentation. On the memory layout page, it states: The jl_value_t struct is the name...

View Article


Combining DiffEqFlux with Turing for Bayesian Inference and Neural ODEs

Hi all, I’m trying to implement a Bayesian Neural Network. The catch is that this neural network is used to approximate a function that is then integrated to predict time series generated by an ODE....

View Article


Different results between Zygote, ForwardDiff, and ReverseDiff

Hi, I’m quite new to Julia and trying to understand automatic differentiation. I have a loss function for a model, and I’m trying to get the gradient and hessian w.r.t parameters fitted to the model....

View Article

Type inference for a singleton of type Function

I have an object that stores (amongst other things) a vector of functions. When I use multiple functions, everything works nicely. However, if I pass it a vector with a single function, I’m getting...

View Article

Arrays of functions

About the following code: f(x) = 2x + 1 g(x) = x^2 h(x) = x^3 I = [f, g, h] J = Array{Function, 2}(undef, 3, 3) for i ∈ 1:3 for j ∈ 1:3 J[i, j] = I[i] ∘ I[j] end end display(J) I get: 3×3...

View Article

REPL I/O in a Pkg instead of `readline()`?

Hi everyone, Working on a package to give interactive tutorials for new Julia users. Hit a stumbling block that I’m not convinced has a good answer. Basically here’s what I want to happen: Hi...

View Article


LINQ inner joins and select all in Query.jl

This MWE is supposed to do an inner join (i.a equals j.c || i.b equals j.e) and output all the elements of the first df: df1 = DataFrame(a=[1,2,3], b=[1.,2.,3.]) df2 = DataFrame(c=[2,4,2], d=["John",...

View Article

Unmarshalling to a Julia type when type has Union in the Attribute values?

Hi, I am trying to unmarshal a json to a Struct type where there is Union in type attributes but it does not work. Is there a way to do that? That exercise works: using Unmarshal input = "{ \"id\":...

View Article


Confused by "unsatisfiable requirements"

I have recently upgraded my package SimpleGraphs to version 0.6.1. Other packages that depend on it now can only be used in development mode. For example, my registered package SimpleGraphAlgorithms...

View Article

Trying to bench two code samples and I'm getting different results @time vs...

I have a DataFrame “results” that is sorted by _.date. I’m experimenting to see the difference between using a filter (A): results |> @filter(_.date >= Dates.Date(2018,1,1) && _.date...

View Article


Using the iteration interface with custom indices

I’m a bit confused on how to use iteration utilities with a custom index set. I tried a MWE (just reproducing a for loop) as follows: struct CustomIndex i::Int end struct CustomIndexSet n::Int end...

View Article

Zygote has a problem of derivation in the loss function

I have a problem with Flux. Unfortunately Zygote cannot derive my loss function and I am not sure what it is. It would be nice if someone could help me with this problem. My loss function looks like...

View Article

Could I use Python Dict or convert Julia Dict to Python Dict in Julia?

Hi, I am writing a piece of code that need to load a Python package with PyCall. But when I transfer a Julia Dict to the package, I got an error. I think it is because the package can not identify the...

View Article
Browsing all 2795 articles
Browse latest View live