# Reduce Interpolating data size for initial guess

**URL:** <https://discourse.julialang.org/t/reduce-interpolating-data-size-for-initial-guess/101116>\
**Category:** Optimization (Mathematical)\
**Tags:** question, interpolations\
**Created:** [July 3, 2023, 10:38am UTC](https://discourse.julialang.org/t/reduce-interpolating-data-size-for-initial-guess/101116 "2023-07-03T10:38:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatrickeTownsend](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patricketownsend/32/50028_2.png) [@PatrickeTownsend](https://discourse.julialang.org/u/PatrickeTownsend)\
**Post date:** [July 3, 2023, 10:38am UTC](https://discourse.julialang.org/t/reduce-interpolating-data-size-for-initial-guess/101116/1 "2023-07-03T10:38:56Z")

</div>

Hello,

I hope someone can help me with this.  
I have a 1x721 data vector with initial guesses, but i need to adjust it to just 200 nodes, is it possible to adjust the vector size by interpolating and reducing its size? I’m trying by using JuMP and Interpolations.jl, but other options are welcome.

I don’t really have an example code for this issue, sorry about that.

Thanks,  
Patrick

---

<div class="post-metadata">

**Author:** ![JM\_Beckers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jm_beckers/32/22482_2.png) [@JM\_Beckers](https://discourse.julialang.org/u/JM_Beckers)\
**Post date:** [July 3, 2023, 11:12am UTC](https://discourse.julialang.org/t/reduce-interpolating-data-size-for-initial-guess/101116/2 "2023-07-03T11:12:36Z")

</div>

Could you be more specific? For example are input data have equal distances between them? Does the 200 point set need to be on a regular (equidistant) grid ? Are the data points noisy ?

---

<div class="post-metadata">

**Author:** ![PatrickeTownsend](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patricketownsend/32/50028_2.png) [@PatrickeTownsend](https://discourse.julialang.org/u/PatrickeTownsend)\
**Post date:** [July 3, 2023, 11:42am UTC](https://discourse.julialang.org/t/reduce-interpolating-data-size-for-initial-guess/101116/3 "2023-07-03T11:42:24Z")

</div>

Hello, the input data is not completely equidistant, it looks like this:

```julia
[0. , 0.0649982 , 0.12999116, 0.19497346, 0.25993975,
       0.32488474, 0.38980326, 0.45469024, 0.51954077, 0.5843501 ,
       0.64911368, 0.71382716, 0.77848642, 0.84308759, 0.90762705,
       0.97210148, 1.03650782, 1.10084332, 1.16510554, 1.22929237,
       1.29340201, 1.35743299, 1.42138416, 1.48525474, 1.54904425,
       1.61275255, 1.67637415, 1.7399153 , 1.80337685, 1.86675999,
       1.93006621, 1.99329728, 2.05645528, 2.11954256, 2.18256174,.....,5.78805045, 5.85291268, 5.91780987, 5.98273707,
       6.04768917, 6.11266096, 6.17764711, 6.24264226, 0.02445568,
       0.08945255, 0.15444214,..]

```

and the 200 points set doesn’t need to be regular, in short terms i want to reduce the size of the vector by keeping the same numerical behavior (tendency).  
The data is not noisy, in other arrays it’s almost constant. The data will be used to set up and Initial guess for an optimization problem.

If there’s a solution only for equidistant data points i think it’ll work  
Hope its clearer now, sorry and thanks.

---

<div class="post-metadata">

**Author:** ![JM\_Beckers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jm_beckers/32/22482_2.png) [@JM\_Beckers](https://discourse.julialang.org/u/JM_Beckers)\
**Post date:** [July 3, 2023, 1:00pm UTC](https://discourse.julialang.org/t/reduce-interpolating-data-size-for-initial-guess/101116/4 "2023-07-03T13:00:03Z")

</div>

Still not sure what your array is, but why not just subsample it ?

```julia
myarray[sort(rand(1:size(myarray)[1],200))]

```
