# How to use DataDrivenDiffEq.jl for simple Sparse Identification without ODE

**URL:** <https://discourse.julialang.org/t/how-to-use-datadrivendiffeq-jl-for-simple-sparse-identification-without-ode/91114>\
**Category:** General Usage\
**Created:** [December 1, 2022, 8:38pm UTC](https://discourse.julialang.org/t/how-to-use-datadrivendiffeq-jl-for-simple-sparse-identification-without-ode/91114 "2022-12-01T20:38:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Molox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/molox/32/35002_2.png) [@Molox](https://discourse.julialang.org/u/Molox)\
**Post date:** [December 1, 2022, 8:38pm UTC](https://discourse.julialang.org/t/how-to-use-datadrivendiffeq-jl-for-simple-sparse-identification-without-ode/91114/1 "2022-12-01T20:38:14Z")

</div>

I try to estimate an expression of y=sin(w+x) where I need to have a parameter of w. It gives an error during solve step. I know it is related to the parameter w but has no clue how to debug.

I saw examples with differential equations but not with a simple “DirectDataDrivenProblem”.

Here is my code:

```julia
using DataDrivenDiffEq
using ModelingToolkit
using DataDrivenSparse
X = rand(1,100)
Y = rand(1,100)
problem = DirectDataDrivenProblem(X, Y)
@variables u[1:1]
@parameters w[1:1]
basis = Basis([sin.(u[1]+w[1]);], u, parameters=w)
println(basis)
res = solve(problem, basis, STLSQ())

```

```julia
BoundsError: attempt to access 0-element view(::Vector{Float64}, :) with eltype Float64 at index [1]

```

Thanks for help!

---

<div class="post-metadata">

**Author:** ![Julius\_Martensen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/julius_martensen/32/17077_2.png) [@Julius\_Martensen](https://discourse.julialang.org/u/Julius_Martensen)\
**Post date:** [December 2, 2022, 10:10am UTC](https://discourse.julialang.org/t/how-to-use-datadrivendiffeq-jl-for-simple-sparse-identification-without-ode/91114/2 "2022-12-02T10:10:04Z")

</div>

Right now the Sparse Regression does not support unknown parameter values ( might be in future releases using either MAP estimation or Bayesian or MINLP ). So you need to provide a parameter value inside your basis.

```nohighlight
problem = DirectDataDrivenProblem(X, Y, p = [1.0])

```

I’ll write a check for that. Sorry.

I would use symbolic regression for now.

---

<div class="post-metadata">

**Author:** ![Molox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/molox/32/35002_2.png) [@Molox](https://discourse.julialang.org/u/Molox)\
**Post date:** [December 5, 2022, 10:14pm UTC](https://discourse.julialang.org/t/how-to-use-datadrivendiffeq-jl-for-simple-sparse-identification-without-ode/91114/4 "2022-12-05T22:14:53Z")

</div>

Thank you！That makes sense.

I will also try the symbolic regression
