Thread
#stdlib
    j

    jimn

    2 years ago
    I wrote a singular feature_range iterator to reduce potential memory paging events when working with potentially large datasets. minmax scaling is integral with tensorflow and similar domains. also related to what's shown here, doing index resampling on downstream tensorflow input. i have two three issues with this as presented:1. I'm not sure how to best generalize the acc to a paramterized type:
    (LocalDate.MAX t2 LocalDate.MIN)
    except with some keyboard practice for each of the primitive types getting thier own minmax 2. related to existing keyboard practice: min and max don't want to behave in intellij with a generic syntax and it's hard to guess the intent of maxOf vs. max, minOf vs. min -- since they both evaluate on pairs where listOf for instance operates on vararg<T> 3. i distrust an immutable loop return where an array of two mutable values might have more mechanical sympathy
    fun feature_range(seq: Sequence<LocalDate>):Pair</**min*/LocalDate,/**max*/LocalDate> = seq.fold(LocalDate.MAX to LocalDate.MIN) { (a, b), localDate ->
        minOf(a, localDate) to maxOf(b, localDate)
    }
    would this be equally efficient if it were a range factory/constructor instead of a pair result?