# \[ANN\] KissSmoothing.jl - Hassle free & simple data smoothing

**URL:** <https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014>\
**Category:** Package Announcements\
**Tags:** smoothing\
**Created:** [March 17, 2022, 9:02am UTC](https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014 "2022-03-17T09:02:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![francesco.alemanno](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)\
**Post date:** [March 17, 2022, 9:02am UTC](https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014/1 "2022-03-17T09:02:27Z")

</div>

I would like to announce a tiny package I made, KissSmoothing, it can be helpful to those like me that sometimes for visualization/processing purposes just want to reasonably smooth some data in a matrix.  
This package offers Gaussian smoothing in Fourier domain, the filter bandwidth is chosen automatically in order for the extracted noise to match the noise in the first derivative of the signal (leading to quite natural smoothing in most cases I’ve tested).

> **[GitHub - francescoalemanno/KissSmoothing.jl: Easily smooth your data in Julia](https://github.com/francescoalemanno/KissSmoothing.jl)**
>
> Easily smooth your data in Julia. Contribute to francescoalemanno/KissSmoothing.jl development by creating an account on GitHub.

The package is registered, so you can install it like any other package. feel free to let me know if you find any issues or if you find some direction for improving it 🙂

Thank you

---

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [March 17, 2022, 9:18am UTC](https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014/2 "2022-03-17T09:18:37Z")

</div>

Nice,

Can you clarify what `dims` is? The readme says “array dimension being smoothed” so is that `size(V)[2]`? or is it the dimension of the output of the command? From the code it looks like it’s `size(V)[2]` so why pass it as an argument?

One suggestion of something you could maybe add in there is the option to subsample the result (so input has `n` observations and output has `m < n`, this could for instance be useful in plots which are made out of a ton of points, you’d smooth and subsample and get a simpler curve supported by fewer points. Just a thought.

Other small notes based on looking at the code (some may be opionated):

- you can make `K1, K2` constants also `K1/K2`
- `V .* 0` is maybe best replaced by `zero(V)`
- sigmat, sigmad should probably be passed as arguments
- number of iterations too
- you could probably merge the isfinite and abs branch together
- you could write the verbose stuff to an IOBuffer so that you don’t branch over verbose in the loop and print the whole lot after the iterations if verbose.

---

<div class="post-metadata">

**Author:** ![francesco.alemanno](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)\
**Post date:** [March 17, 2022, 9:23am UTC](https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014/3 "2022-03-17T09:23:10Z")

</div>

Hello! Thank you for your feedback,  
in the code “dims” is defaulted to being the last dimension of the input tensor. Which means that if you have a 3D curve represented discretely as matrix of size [3,3000] the smoothing procedure will act along the second dimension. The dims parameter works in exactly the same manner as most Julia functions supporting it 🙂  
Nice idea about subsampling, maybe I will add another method to discard points.

---

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [March 17, 2022, 9:24am UTC](https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014/4 "2022-03-17T09:24:40Z")

</div>

ah right that makes sense, thanks, (I added a few comments in my previous answer wrt to the code btw but you were too quick for me 😄 )

---

<div class="post-metadata">

**Author:** ![francesco.alemanno](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)\
**Post date:** [March 17, 2022, 9:32am UTC](https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014/5 "2022-03-17T09:32:25Z")

</div>

I tried to answer all of your points, thank you for taking the time to review my code, ~~I will implement some of your suggestions 🙂~~ [done]

> [@tlienart](#):
>
> Other small notes based on looking at the code (some may be opionated):
> 
> - you can make `K1, K2` constants also `K1/K2`
> 
> – I plan to have a more general criteria for choosing bandwidth, that’s the reason I kept these separate 🙂
> 
> - `V .* 0` is maybe best replaced by `zero(V)`
> 
> – Thank you, perhaps it is best to replace this indeed
> 
> - sigmat, sigmad should probably be passed as arguments
> 
> – These parameters will not change, they are the only reasonable starting points for the bisection solver included in the function, changing them can only throw off the solver
> 
> - number of iterations too
> 
> – Bisection for a float param in [0,1] usually converges in ~30 iterations so it will stop much earlier, I think that option would never be used, I will think about this
> 
> - you could probably merge the isfinite and abs branch together
> 
> – ah, I want to stop early if the σ variable becomes infinite, so that’s why I kept them separate.
> 
> - you could write the verbose stuff to an IOBuffer so that you don’t branch over verbose in the loop and print the whole lot after the iterations if verbose.
> 
> – Excellent tip, I will definitely do this.

---

<div class="post-metadata">

**Author:** ![luciano-drozda](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luciano-drozda/32/33789_2.png) [@luciano-drozda](https://discourse.julialang.org/u/luciano-drozda)\
**Post date:** [March 17, 2022, 9:34am UTC](https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014/6 "2022-03-17T09:34:02Z")

</div>

Thank you for the package !  
I’d say that someone looking for such a tool would first look into the examples before code.  
I think you could maybe add labels, legends and possibly titles to your plots on the README, this makes it easier to differentiate raw and smoothed curves, for instance.

---

<div class="post-metadata">

**Author:** ![francesco.alemanno](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)\
**Post date:** [March 17, 2022, 9:35am UTC](https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014/7 "2022-03-17T09:35:40Z")

</div>

~~Yes the plots were a bit rushed, I will definitely add a legend,~~ [done] I think it is a good thing that original and smoothed data are hard to distinguish 😃

---

<div class="post-metadata">

**Author:** ![francesco.alemanno](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)\
**Post date:** [April 2, 2022, 8:04pm UTC](https://discourse.julialang.org/t/ann-kisssmoothing-jl-hassle-free-simple-data-smoothing/78014/8 "2022-04-02T20:04:52Z")

</div>

Released 1.0.1,  
Added method `fit_rbf`, this package now is also able to fit an interpolating/smoothing thin plate spline to a given dataset.
