plot-base/src/commonMain/kotlin/org/jetbrains/letsPlot/core/plot/base/stat/SmoothStat.kt [81:124]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ) // also conditional Y_MIN / Y_MAX const val DEF_EVAL_POINT_COUNT = 80 val DEF_SMOOTHING_METHOD = Method.LM const val DEF_CONFIDENCE_LEVEL = 0.95 // 95 % const val DEF_DISPLAY_CONFIDENCE_INTERVAL = true const val DEF_SPAN = 0.5 const val DEF_DEG = 1 const val DEF_LOESS_CRITICAL_SIZE = 1_000 const val DEF_SAMPLING_SEED = 37L } override fun consumes(): List> { return listOf(Aes.X, Aes.Y) } private fun needSampling(rowCount: Int): Boolean { if (smoothingMethod != Method.LOESS) { return false } if (rowCount <= loessCriticalSize) { return false } return true } private fun applySampling(data: DataFrame, messageConsumer: (s: String) -> Unit): DataFrame { val msg = "LOESS drew a random sample with max_n=$loessCriticalSize, seed=$samplingSeed" messageConsumer(msg) return SamplingUtil.sampleWithoutReplacement(loessCriticalSize, Random(samplingSeed), data) } override fun apply(data: DataFrame, statCtx: StatContext, messageConsumer: (s: String) -> Unit): DataFrame { if (!hasRequiredValues(data, Aes.Y)) { return withEmptyStatValues() } @Suppress("NAME_SHADOWING") var data = data if (needSampling(data.rowCount())) { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - plot-base/src/commonMain/kotlin/org/jetbrains/letsPlot/core/plot/base/stat/SmoothStatInfo.kt [48:90]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ) const val DEF_EVAL_POINT_COUNT = 80 val DEF_SMOOTHING_METHOD = Method.LM const val DEF_CONFIDENCE_LEVEL = 0.95 // 95 % const val DEF_DISPLAY_CONFIDENCE_INTERVAL = true const val DEF_SPAN = 0.5 const val DEF_DEG = 1 const val DEF_LOESS_CRITICAL_SIZE = 1_000 const val DEF_SAMPLING_SEED = 37L } override fun consumes(): List> { return listOf(Aes.X, Aes.Y) } private fun needSampling(rowCount: Int): Boolean { if (smoothingMethod != Method.LOESS) { return false } if (rowCount <= loessCriticalSize) { return false } return true } private fun applySampling(data: DataFrame, messageConsumer: (s: String) -> Unit): DataFrame { val msg = "LOESS drew a random sample with max_n=$loessCriticalSize, seed=$samplingSeed" messageConsumer(msg) return SamplingUtil.sampleWithoutReplacement(loessCriticalSize, Random(samplingSeed), data) } override fun apply(data: DataFrame, statCtx: StatContext, messageConsumer: (s: String) -> Unit): DataFrame { if (!hasRequiredValues(data, Aes.Y)) { return withEmptyStatValues() } @Suppress("NAME_SHADOWING") var data = data if (needSampling(data.rowCount())) { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -