feat: 15 funciones datascience — estadística, DSP e IO de datos
12 funciones puras con implementación real: Standardize, MinMaxScale, Clip, RollingWindow, ZipSlices, GroupBy, Histogram, Pearson, Autocorrelation, FFT (Cooley-Tukey), DetectOutliers, Impute 3 funciones impuras (stubs): LoadCSV, LoadParquet, FetchDataFrame Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package datascience
|
||||
|
||||
// RollingWindow genera ventanas deslizantes de tamaño size sobre el slice xs.
|
||||
// Si size <= 0 o size > len(xs), retorna nil.
|
||||
func RollingWindow[T any](xs []T, size int) [][]T {
|
||||
n := len(xs)
|
||||
if size <= 0 || size > n {
|
||||
return nil
|
||||
}
|
||||
windows := make([][]T, 0, n-size+1)
|
||||
for i := 0; i <= n-size; i++ {
|
||||
w := make([]T, size)
|
||||
copy(w, xs[i:i+size])
|
||||
windows = append(windows, w)
|
||||
}
|
||||
return windows
|
||||
}
|
||||
Reference in New Issue
Block a user