//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** @author Hao Peng, John Miller * @version 2.0 * @date Tue Sep 29 14:14:15 EDT 2015 * @see LICENSE (MIT style license file). * * @note Example Dataset: Automobile Miles Per Gallon (MPG) */ package scalation package modeling import scala.runtime.ScalaRunTime.stringOf import scalation.mathstat._ //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** The `Example_AutoMPG` object stored the UCI AutoMPG dataset in a matrix. * @see archive.ics.uci.edu/ml/datasets/Auto+MPG */ object Example_AutoMPG: /** the names of the predictor variables; the name of response variable is mpg */ val xr_fname = Array ("cylinders", "displacement", "horsepower", "weight", "acceleration", "modelyear", "origin") /** the raw combined data matrix 'xyr' */ val xyr = MatrixD ((392, 8), 8, 307, 130, 3504, 12, 70, 1, 18, 8, 350, 165, 3693, 11.5, 70, 1, 15, 8, 318, 150, 3436, 11, 70, 1, 18, 8, 304, 150, 3433, 12, 70, 1, 16, 8, 302, 140, 3449, 10.5, 70, 1, 17, 8, 429, 198, 4341, 10, 70, 1, 15, 8, 454, 220, 4354, 9, 70, 1, 14, 8, 440, 215, 4312, 8.5, 70, 1, 14, 8, 455, 225, 4425, 10, 70, 1, 14, 8, 390, 190, 3850, 8.5, 70, 1, 15, 8, 383, 170, 3563, 10, 70, 1, 15, 8, 340, 160, 3609, 8, 70, 1, 14, 8, 400, 150, 3761, 9.5, 70, 1, 15, 8, 455, 225, 3086, 10, 70, 1, 14, 4, 113, 95, 2372, 15, 70, 3, 24, 6, 198, 95, 2833, 15.5, 70, 1, 22, 6, 199, 97, 2774, 15.5, 70, 1, 18, 6, 200, 85, 2587, 16, 70, 1, 21, 4, 97, 88, 2130, 14.5, 70, 3, 27, 4, 97, 46, 1835, 20.5, 70, 2, 26, 4, 110, 87, 2672, 17.5, 70, 2, 25, 4, 107, 90, 2430, 14.5, 70, 2, 24, 4, 104, 95, 2375, 17.5, 70, 2, 25, 4, 121, 113, 2234, 12.5, 70, 2, 26, 6, 199, 90, 2648, 15, 70, 1, 21, 8, 360, 215, 4615, 14, 70, 1, 10, 8, 307, 200, 4376, 15, 70, 1, 10, 8, 318, 210, 4382, 13.5, 70, 1, 11, 8, 304, 193, 4732, 18.5, 70, 1, 9, 4, 97, 88, 2130, 14.5, 71, 3, 27, 4, 140, 90, 2264, 15.5, 71, 1, 28, 4, 113, 95, 2228, 14, 71, 3, 25, 6, 232, 100, 2634, 13, 71, 1, 19, 6, 225, 105, 3439, 15.5, 71, 1, 16, 6, 250, 100, 3329, 15.5, 71, 1, 17, 6, 250, 88, 3302, 15.5, 71, 1, 19, 6, 232, 100, 3288, 15.5, 71, 1, 18, 8, 350, 165, 4209, 12, 71, 1, 14, 8, 400, 175, 4464, 11.5, 71, 1, 14, 8, 351, 153, 4154, 13.5, 71, 1, 14, 8, 318, 150, 4096, 13, 71, 1, 14, 8, 383, 180, 4955, 11.5, 71, 1, 12, 8, 400, 170, 4746, 12, 71, 1, 13, 8, 400, 175, 5140, 12, 71, 1, 13, 6, 258, 110, 2962, 13.5, 71, 1, 18, 4, 140, 72, 2408, 19, 71, 1, 22, 6, 250, 100, 3282, 15, 71, 1, 19, 6, 250, 88, 3139, 14.5, 71, 1, 18, 4, 122, 86, 2220, 14, 71, 1, 23, 4, 116, 90, 2123, 14, 71, 2, 28, 4, 79, 70, 2074, 19.5, 71, 2, 30, 4, 88, 76, 2065, 14.5, 71, 2, 30, 4, 71, 65, 1773, 19, 71, 3, 31, 4, 72, 69, 1613, 18, 71, 3, 35, 4, 97, 60, 1834, 19, 71, 2, 27, 4, 91, 70, 1955, 20.5, 71, 1, 26, 4, 113, 95, 2278, 15.5, 72, 3, 24, 4, 97.5, 80, 2126, 17, 72, 1, 25, 4, 97, 54, 2254, 23.5, 72, 2, 23, 4, 140, 90, 2408, 19.5, 72, 1, 20, 4, 122, 86, 2226, 16.5, 72, 1, 21, 8, 350, 165, 4274, 12, 72, 1, 13, 8, 400, 175, 4385, 12, 72, 1, 14, 8, 318, 150, 4135, 13.5, 72, 1, 15, 8, 351, 153, 4129, 13, 72, 1, 14, 8, 304, 150, 3672, 11.5, 72, 1, 17, 8, 429, 208, 4633, 11, 72, 1, 11, 8, 350, 155, 4502, 13.5, 72, 1, 13, 8, 350, 160, 4456, 13.5, 72, 1, 12, 8, 400, 190, 4422, 12.5, 72, 1, 13, 3, 70, 97, 2330, 13.5, 72, 3, 19, 8, 304, 150, 3892, 12.5, 72, 1, 15, 8, 307, 130, 4098, 14, 72, 1, 13, 8, 302, 140, 4294, 16, 72, 1, 13, 8, 318, 150, 4077, 14, 72, 1, 14, 4, 121, 112, 2933, 14.5, 72, 2, 18, 4, 121, 76, 2511, 18, 72, 2, 22, 4, 120, 87, 2979, 19.5, 72, 2, 21, 4, 96, 69, 2189, 18, 72, 2, 26, 4, 122, 86, 2395, 16, 72, 1, 22, 4, 97, 92, 2288, 17, 72, 3, 28, 4, 120, 97, 2506, 14.5, 72, 3, 23, 4, 98, 80, 2164, 15, 72, 1, 28, 4, 97, 88, 2100, 16.5, 72, 3, 27, 8, 350, 175, 4100, 13, 73, 1, 13, 8, 304, 150, 3672, 11.5, 73, 1, 14, 8, 350, 145, 3988, 13, 73, 1, 13, 8, 302, 137, 4042, 14.5, 73, 1, 14, 8, 318, 150, 3777, 12.5, 73, 1, 15, 8, 429, 198, 4952, 11.5, 73, 1, 12, 8, 400, 150, 4464, 12, 73, 1, 13, 8, 351, 158, 4363, 13, 73, 1, 13, 8, 318, 150, 4237, 14.5, 73, 1, 14, 8, 440, 215, 4735, 11, 73, 1, 13, 8, 455, 225, 4951, 11, 73, 1, 12, 8, 360, 175, 3821, 11, 73, 1, 13, 6, 225, 105, 3121, 16.5, 73, 1, 18, 6, 250, 100, 3278, 18, 73, 1, 16, 6, 232, 100, 2945, 16, 73, 1, 18, 6, 250, 88, 3021, 16.5, 73, 1, 18, 6, 198, 95, 2904, 16, 73, 1, 23, 4, 97, 46, 1950, 21, 73, 2, 26, 8, 400, 150, 4997, 14, 73, 1, 11, 8, 400, 167, 4906, 12.5, 73, 1, 12, 8, 360, 170, 4654, 13, 73, 1, 13, 8, 350, 180, 4499, 12.5, 73, 1, 12, 6, 232, 100, 2789, 15, 73, 1, 18, 4, 97, 88, 2279, 19, 73, 3, 20, 4, 140, 72, 2401, 19.5, 73, 1, 21, 4, 108, 94, 2379, 16.5, 73, 3, 22, 3, 70, 90, 2124, 13.5, 73, 3, 18, 4, 122, 85, 2310, 18.5, 73, 1, 19, 6, 155, 107, 2472, 14, 73, 1, 21, 4, 98, 90, 2265, 15.5, 73, 2, 26, 8, 350, 145, 4082, 13, 73, 1, 15, 8, 400, 230, 4278, 9.5, 73, 1, 16, 4, 68, 49, 1867, 19.5, 73, 2, 29, 4, 116, 75, 2158, 15.5, 73, 2, 24, 4, 114, 91, 2582, 14, 73, 2, 20, 4, 121, 112, 2868, 15.5, 73, 2, 19, 8, 318, 150, 3399, 11, 73, 1, 15, 4, 121, 110, 2660, 14, 73, 2, 24, 6, 156, 122, 2807, 13.5, 73, 3, 20, 8, 350, 180, 3664, 11, 73, 1, 11, 6, 198, 95, 3102, 16.5, 74, 1, 20, 6, 232, 100, 2901, 16, 74, 1, 19, 6, 250, 100, 3336, 17, 74, 1, 15, 4, 79, 67, 1950, 19, 74, 3, 31, 4, 122, 80, 2451, 16.5, 74, 1, 26, 4, 71, 65, 1836, 21, 74, 3, 32, 4, 140, 75, 2542, 17, 74, 1, 25, 6, 250, 100, 3781, 17, 74, 1, 16, 6, 258, 110, 3632, 18, 74, 1, 16, 6, 225, 105, 3613, 16.5, 74, 1, 18, 8, 302, 140, 4141, 14, 74, 1, 16, 8, 350, 150, 4699, 14.5, 74, 1, 13, 8, 318, 150, 4457, 13.5, 74, 1, 14, 8, 302, 140, 4638, 16, 74, 1, 14, 8, 304, 150, 4257, 15.5, 74, 1, 14, 4, 98, 83, 2219, 16.5, 74, 2, 29, 4, 79, 67, 1963, 15.5, 74, 2, 26, 4, 97, 78, 2300, 14.5, 74, 2, 26, 4, 76, 52, 1649, 16.5, 74, 3, 31, 4, 83, 61, 2003, 19, 74, 3, 32, 4, 90, 75, 2125, 14.5, 74, 1, 28, 4, 90, 75, 2108, 15.5, 74, 2, 24, 4, 116, 75, 2246, 14, 74, 2, 26, 4, 120, 97, 2489, 15, 74, 3, 24, 4, 108, 93, 2391, 15.5, 74, 3, 26, 4, 79, 67, 2000, 16, 74, 2, 31, 6, 225, 95, 3264, 16, 75, 1, 19, 6, 250, 105, 3459, 16, 75, 1, 18, 6, 250, 72, 3432, 21, 75, 1, 15, 6, 250, 72, 3158, 19.5, 75, 1, 15, 8, 400, 170, 4668, 11.5, 75, 1, 16, 8, 350, 145, 4440, 14, 75, 1, 15, 8, 318, 150, 4498, 14.5, 75, 1, 16, 8, 351, 148, 4657, 13.5, 75, 1, 14, 6, 231, 110, 3907, 21, 75, 1, 17, 6, 250, 105, 3897, 18.5, 75, 1, 16, 6, 258, 110, 3730, 19, 75, 1, 15, 6, 225, 95, 3785, 19, 75, 1, 18, 6, 231, 110, 3039, 15, 75, 1, 21, 8, 262, 110, 3221, 13.5, 75, 1, 20, 8, 302, 129, 3169, 12, 75, 1, 13, 4, 97, 75, 2171, 16, 75, 3, 29, 4, 140, 83, 2639, 17, 75, 1, 23, 6, 232, 100, 2914, 16, 75, 1, 20, 4, 140, 78, 2592, 18.5, 75, 1, 23, 4, 134, 96, 2702, 13.5, 75, 3, 24, 4, 90, 71, 2223, 16.5, 75, 2, 25, 4, 119, 97, 2545, 17, 75, 3, 24, 6, 171, 97, 2984, 14.5, 75, 1, 18, 4, 90, 70, 1937, 14, 75, 2, 29, 6, 232, 90, 3211, 17, 75, 1, 19, 4, 115, 95, 2694, 15, 75, 2, 23, 4, 120, 88, 2957, 17, 75, 2, 23, 4, 121, 98, 2945, 14.5, 75, 2, 22, 4, 121, 115, 2671, 13.5, 75, 2, 25, 4, 91, 53, 1795, 17.5, 75, 3, 33, 4, 107, 86, 2464, 15.5, 76, 2, 28, 4, 116, 81, 2220, 16.9, 76, 2, 25, 4, 140, 92, 2572, 14.9, 76, 1, 25, 4, 98, 79, 2255, 17.7, 76, 1, 26, 4, 101, 83, 2202, 15.3, 76, 2, 27, 8, 305, 140, 4215, 13, 76, 1, 17.5, 8, 318, 150, 4190, 13, 76, 1, 16, 8, 304, 120, 3962, 13.9, 76, 1, 15.5, 8, 351, 152, 4215, 12.8, 76, 1, 14.5, 6, 225, 100, 3233, 15.4, 76, 1, 22, 6, 250, 105, 3353, 14.5, 76, 1, 22, 6, 200, 81, 3012, 17.6, 76, 1, 24, 6, 232, 90, 3085, 17.6, 76, 1, 22.5, 4, 85, 52, 2035, 22.2, 76, 1, 29, 4, 98, 60, 2164, 22.1, 76, 1, 24.5, 4, 90, 70, 1937, 14.2, 76, 2, 29, 4, 91, 53, 1795, 17.4, 76, 3, 33, 6, 225, 100, 3651, 17.7, 76, 1, 20, 6, 250, 78, 3574, 21, 76, 1, 18, 6, 250, 110, 3645, 16.2, 76, 1, 18.5, 6, 258, 95, 3193, 17.8, 76, 1, 17.5, 4, 97, 71, 1825, 12.2, 76, 2, 29.5, 4, 85, 70, 1990, 17, 76, 3, 32, 4, 97, 75, 2155, 16.4, 76, 3, 28, 4, 140, 72, 2565, 13.6, 76, 1, 26.5, 4, 130, 102, 3150, 15.7, 76, 2, 20, 8, 318, 150, 3940, 13.2, 76, 1, 13, 4, 120, 88, 3270, 21.9, 76, 2, 19, 6, 156, 108, 2930, 15.5, 76, 3, 19, 6, 168, 120, 3820, 16.7, 76, 2, 16.5, 8, 350, 180, 4380, 12.1, 76, 1, 16.5, 8, 350, 145, 4055, 12, 76, 1, 13, 8, 302, 130, 3870, 15, 76, 1, 13, 8, 318, 150, 3755, 14, 76, 1, 13, 4, 98, 68, 2045, 18.5, 77, 3, 31.5, 4, 111, 80, 2155, 14.8, 77, 1, 30, 4, 79, 58, 1825, 18.6, 77, 2, 36, 4, 122, 96, 2300, 15.5, 77, 1, 25.5, 4, 85, 70, 1945, 16.8, 77, 3, 33.5, 8, 305, 145, 3880, 12.5, 77, 1, 17.5, 8, 260, 110, 4060, 19, 77, 1, 17, 8, 318, 145, 4140, 13.7, 77, 1, 15.5, 8, 302, 130, 4295, 14.9, 77, 1, 15, 6, 250, 110, 3520, 16.4, 77, 1, 17.5, 6, 231, 105, 3425, 16.9, 77, 1, 20.5, 6, 225, 100, 3630, 17.7, 77, 1, 19, 6, 250, 98, 3525, 19, 77, 1, 18.5, 8, 400, 180, 4220, 11.1, 77, 1, 16, 8, 350, 170, 4165, 11.4, 77, 1, 15.5, 8, 400, 190, 4325, 12.2, 77, 1, 15.5, 8, 351, 149, 4335, 14.5, 77, 1, 16, 4, 97, 78, 1940, 14.5, 77, 2, 29, 4, 151, 88, 2740, 16, 77, 1, 24.5, 4, 97, 75, 2265, 18.2, 77, 3, 26, 4, 140, 89, 2755, 15.8, 77, 1, 25.5, 4, 98, 63, 2051, 17, 77, 1, 30.5, 4, 98, 83, 2075, 15.9, 77, 1, 33.5, 4, 97, 67, 1985, 16.4, 77, 3, 30, 4, 97, 78, 2190, 14.1, 77, 2, 30.5, 6, 146, 97, 2815, 14.5, 77, 3, 22, 4, 121, 110, 2600, 12.8, 77, 2, 21.5, 3, 80, 110, 2720, 13.5, 77, 3, 21.5, 4, 90, 48, 1985, 21.5, 78, 2, 43.1, 4, 98, 66, 1800, 14.4, 78, 1, 36.1, 4, 78, 52, 1985, 19.4, 78, 3, 32.8, 4, 85, 70, 2070, 18.6, 78, 3, 39.4, 4, 91, 60, 1800, 16.4, 78, 3, 36.1, 8, 260, 110, 3365, 15.5, 78, 1, 19.9, 8, 318, 140, 3735, 13.2, 78, 1, 19.4, 8, 302, 139, 3570, 12.8, 78, 1, 20.2, 6, 231, 105, 3535, 19.2, 78, 1, 19.2, 6, 200, 95, 3155, 18.2, 78, 1, 20.5, 6, 200, 85, 2965, 15.8, 78, 1, 20.2, 4, 140, 88, 2720, 15.4, 78, 1, 25.1, 6, 225, 100, 3430, 17.2, 78, 1, 20.5, 6, 232, 90, 3210, 17.2, 78, 1, 19.4, 6, 231, 105, 3380, 15.8, 78, 1, 20.6, 6, 200, 85, 3070, 16.7, 78, 1, 20.8, 6, 225, 110, 3620, 18.7, 78, 1, 18.6, 6, 258, 120, 3410, 15.1, 78, 1, 18.1, 8, 305, 145, 3425, 13.2, 78, 1, 19.2, 6, 231, 165, 3445, 13.4, 78, 1, 17.7, 8, 302, 139, 3205, 11.2, 78, 1, 18.1, 8, 318, 140, 4080, 13.7, 78, 1, 17.5, 4, 98, 68, 2155, 16.5, 78, 1, 30, 4, 134, 95, 2560, 14.2, 78, 3, 27.5, 4, 119, 97, 2300, 14.7, 78, 3, 27.2, 4, 105, 75, 2230, 14.5, 78, 1, 30.9, 4, 134, 95, 2515, 14.8, 78, 3, 21.1, 4, 156, 105, 2745, 16.7, 78, 1, 23.2, 4, 151, 85, 2855, 17.6, 78, 1, 23.8, 4, 119, 97, 2405, 14.9, 78, 3, 23.9, 5, 131, 103, 2830, 15.9, 78, 2, 20.3, 6, 163, 125, 3140, 13.6, 78, 2, 17, 4, 121, 115, 2795, 15.7, 78, 2, 21.6, 6, 163, 133, 3410, 15.8, 78, 2, 16.2, 4, 89, 71, 1990, 14.9, 78, 2, 31.5, 4, 98, 68, 2135, 16.6, 78, 3, 29.5, 6, 231, 115, 3245, 15.4, 79, 1, 21.5, 6, 200, 85, 2990, 18.2, 79, 1, 19.8, 4, 140, 88, 2890, 17.3, 79, 1, 22.3, 6, 232, 90, 3265, 18.2, 79, 1, 20.2, 6, 225, 110, 3360, 16.6, 79, 1, 20.6, 8, 305, 130, 3840, 15.4, 79, 1, 17, 8, 302, 129, 3725, 13.4, 79, 1, 17.6, 8, 351, 138, 3955, 13.2, 79, 1, 16.5, 8, 318, 135, 3830, 15.2, 79, 1, 18.2, 8, 350, 155, 4360, 14.9, 79, 1, 16.9, 8, 351, 142, 4054, 14.3, 79, 1, 15.5, 8, 267, 125, 3605, 15, 79, 1, 19.2, 8, 360, 150, 3940, 13, 79, 1, 18.5, 4, 89, 71, 1925, 14, 79, 2, 31.9, 4, 86, 65, 1975, 15.2, 79, 3, 34.1, 4, 98, 80, 1915, 14.4, 79, 1, 35.7, 4, 121, 80, 2670, 15, 79, 1, 27.4, 5, 183, 77, 3530, 20.1, 79, 2, 25.4, 8, 350, 125, 3900, 17.4, 79, 1, 23, 4, 141, 71, 3190, 24.8, 79, 2, 27.2, 8, 260, 90, 3420, 22.2, 79, 1, 23.9, 4, 105, 70, 2200, 13.2, 79, 1, 34.2, 4, 105, 70, 2150, 14.9, 79, 1, 34.5, 4, 85, 65, 2020, 19.2, 79, 3, 31.8, 4, 91, 69, 2130, 14.7, 79, 2, 37.3, 4, 151, 90, 2670, 16, 79, 1, 28.4, 6, 173, 115, 2595, 11.3, 79, 1, 28.8, 6, 173, 115, 2700, 12.9, 79, 1, 26.8, 4, 151, 90, 2556, 13.2, 79, 1, 33.5, 4, 98, 76, 2144, 14.7, 80, 2, 41.5, 4, 89, 60, 1968, 18.8, 80, 3, 38.1, 4, 98, 70, 2120, 15.5, 80, 1, 32.1, 4, 86, 65, 2019, 16.4, 80, 3, 37.2, 4, 151, 90, 2678, 16.5, 80, 1, 28, 4, 140, 88, 2870, 18.1, 80, 1, 26.4, 4, 151, 90, 3003, 20.1, 80, 1, 24.3, 6, 225, 90, 3381, 18.7, 80, 1, 19.1, 4, 97, 78, 2188, 15.8, 80, 2, 34.3, 4, 134, 90, 2711, 15.5, 80, 3, 29.8, 4, 120, 75, 2542, 17.5, 80, 3, 31.3, 4, 119, 92, 2434, 15, 80, 3, 37, 4, 108, 75, 2265, 15.2, 80, 3, 32.2, 4, 86, 65, 2110, 17.9, 80, 3, 46.6, 4, 156, 105, 2800, 14.4, 80, 1, 27.9, 4, 85, 65, 2110, 19.2, 80, 3, 40.8, 4, 90, 48, 2085, 21.7, 80, 2, 44.3, 4, 90, 48, 2335, 23.7, 80, 2, 43.4, 5, 121, 67, 2950, 19.9, 80, 2, 36.4, 4, 146, 67, 3250, 21.8, 80, 2, 30, 4, 91, 67, 1850, 13.8, 80, 3, 44.6, 4, 97, 67, 2145, 18, 80, 3, 33.8, 4, 89, 62, 1845, 15.3, 80, 2, 29.8, 6, 168, 132, 2910, 11.4, 80, 3, 32.7, 3, 70, 100, 2420, 12.5, 80, 3, 23.7, 4, 122, 88, 2500, 15.1, 80, 2, 35, 4, 107, 72, 2290, 17, 80, 3, 32.4, 4, 135, 84, 2490, 15.7, 81, 1, 27.2, 4, 151, 84, 2635, 16.4, 81, 1, 26.6, 4, 156, 92, 2620, 14.4, 81, 1, 25.8, 6, 173, 110, 2725, 12.6, 81, 1, 23.5, 4, 135, 84, 2385, 12.9, 81, 1, 30, 4, 79, 58, 1755, 16.9, 81, 3, 39.1, 4, 86, 64, 1875, 16.4, 81, 1, 39, 4, 81, 60, 1760, 16.1, 81, 3, 35.1, 4, 97, 67, 2065, 17.8, 81, 3, 32.3, 4, 85, 65, 1975, 19.4, 81, 3, 37, 4, 89, 62, 2050, 17.3, 81, 3, 37.7, 4, 91, 68, 1985, 16, 81, 3, 34.1, 4, 105, 63, 2215, 14.9, 81, 1, 34.7, 4, 98, 65, 2045, 16.2, 81, 1, 34.4, 4, 98, 65, 2380, 20.7, 81, 1, 29.9, 4, 105, 74, 2190, 14.2, 81, 2, 33, 4, 107, 75, 2210, 14.4, 81, 3, 33.7, 4, 108, 75, 2350, 16.8, 81, 3, 32.4, 4, 119, 100, 2615, 14.8, 81, 3, 32.9, 4, 120, 74, 2635, 18.3, 81, 3, 31.6, 4, 141, 80, 3230, 20.4, 81, 2, 28.1, 6, 145, 76, 3160, 19.6, 81, 2, 30.7, 6, 168, 116, 2900, 12.6, 81, 3, 25.4, 6, 146, 120, 2930, 13.8, 81, 3, 24.2, 6, 231, 110, 3415, 15.8, 81, 1, 22.4, 8, 350, 105, 3725, 19, 81, 1, 26.6, 6, 200, 88, 3060, 17.1, 81, 1, 20.2, 6, 225, 85, 3465, 16.6, 81, 1, 17.6, 4, 112, 88, 2605, 19.6, 82, 1, 28, 4, 112, 88, 2640, 18.6, 82, 1, 27, 4, 112, 88, 2395, 18, 82, 1, 34, 4, 112, 85, 2575, 16.2, 82, 1, 31, 4, 135, 84, 2525, 16, 82, 1, 29, 4, 151, 90, 2735, 18, 82, 1, 27, 4, 140, 92, 2865, 16.4, 82, 1, 24, 4, 105, 74, 1980, 15.3, 82, 2, 36, 4, 91, 68, 2025, 18.2, 82, 3, 37, 4, 91, 68, 1970, 17.6, 82, 3, 31, 4, 105, 63, 2125, 14.7, 82, 1, 38, 4, 98, 70, 2125, 17.3, 82, 1, 36, 4, 120, 88, 2160, 14.5, 82, 3, 36, 4, 107, 75, 2205, 14.5, 82, 3, 36, 4, 108, 70, 2245, 16.9, 82, 3, 34, 4, 91, 67, 1965, 15, 82, 3, 38, 4, 91, 67, 1965, 15.7, 82, 3, 32, 4, 91, 67, 1995, 16.2, 82, 3, 38, 6, 181, 110, 2945, 16.4, 82, 1, 25, 6, 262, 85, 3015, 17, 82, 1, 38, 4, 156, 92, 2585, 14.5, 82, 1, 26, 6, 232, 112, 2835, 14.7, 82, 1, 22, 4, 144, 96, 2665, 13.9, 82, 3, 32, 4, 135, 84, 2370, 13, 82, 1, 36, 4, 151, 90, 2950, 17.3, 82, 1, 27, 4, 140, 86, 2790, 15.6, 82, 1, 27, 4, 97, 52, 2130, 24.6, 82, 2, 44, 4, 135, 84, 2295, 11.6, 82, 1, 32, 4, 120, 79, 2625, 18.6, 82, 1, 28, 4, 119, 82, 2720, 19.4, 82, 1, 31) /** the origin column (6) is categorical */ val oxr = xyr.not(?, 7) val oxr_fname: Array [String] = Array ("intercept") ++ xr_fname /** the combined data matrix xy with the origin column (6) removed */ val xy = xyr.not(?, 6) // remove the origin column // val xy = xyr // use all columns - may cause multi-collinearity private val n = xy.dim2 - 1 // last column in xy val (x, y) = (xy.not(?, n), xy(?, n)) // (data/input matrix, response column) val yy = MatrixD.fromVector (y) // turn the m-vector y into an m-by-1 matrix val _1 = VectorD.one (xy.dim) // vector of all ones val oxy = _1 +^: xy // prepend a column of all ones to xy val ox = _1 +^: x // prepend a column of all ones to x val x_fname: Array [String] = xr_fname.take (6) val ox_fname: Array [String] = Array ("intercept") ++ x_fname val x046_fname = Array (ox_fname(0), ox_fname(4), ox_fname(6)) val x046 = ox(?, Array (0, 4, 6)) // best two features with intercept for i <- x046.indices do x046(i, 1) /= 1000.0 // put weight in 1000 pound units val x46_fname = Array (ox_fname(4), ox_fname(6)) val x46 = x046.not(?, 0) // best two features without intercept end Example_AutoMPG import Example_AutoMPG._ //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** The `example_AutoMPG_Correlation` main function performs correlation analysis on * the UCI AutoMPG dataset. * @see archive.ics.uci.edu/ml/datasets/Auto+MPG * > runMain scalation.modeling.example_AutoMPG_Correlation */ @main def example_AutoMPG_Correlation (): Unit = banner ("Variable Names in AutoMPG Dataset") println (s"xr_fname = ${stringOf (xr_fname)}") // raw dataset println (s"x_fname = ${stringOf (x_fname)}") // origin column removed println (s"ox_fname = ${stringOf (ox_fname)}") // intercept (1's) added banner ("Correlation Analysis: reponse y vs. column x(?, j)") for j <- x.indices2 do val x_j = x(?, j) val correlation = y corr x_j val corr2 = correlation * correlation println (s"correlation of y vs. x(?, $j) = $correlation \t $corr2 \t ${x_fname(j)}") new Plot (x_j, y, null, s"y vs, x(?, $j)") end for end example_AutoMPG_Correlation //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** The `example_AutoMPG_NullModel` main function performs `NullModel` on the UCI AutoMPG * dataset. * @see archive.ics.uci.edu/ml/datasets/Auto+MPG * > runMain scalation.modeling.example_AutoMPG_NullModel */ @main def example_AutoMPG_NullModel (): Unit = banner ("NullModel model: y = b₀") val mod = NullModel (xy) // create a null model mod.trainNtest ()() // train and test the model val x = xy(?, 0 to 1) // predictors variables/columns val yp = mod.predict (x) // predict y for all x rows val e = y - yp // error/residual vector println (s"error e = $e") new Plot (null, y, yp, "NullModel") new Plot (null, e, null, "NullModel error") end example_AutoMPG_NullModel //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** The `example_AutoMPG_SimplerRegression` main function performs `SimplerRegression` * on the UCI AutoMPG dataset. * @see archive.ics.uci.edu/ml/datasets/Auto+MPG * > runMain scalation.modeling.example_AutoMPG_SimplerRegression */ @main def example_AutoMPG_SimplerRegression (): Unit = banner ("SimplerRegression model: y = b₁*x₁") val mod = SimplerRegression (xy) // create a SimplerRegression model mod.trainNtest ()() // train and test the model end example_AutoMPG_SimplerRegression //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** The `example_AutoMPG_SimpleRegression` main function performs `SimpleRegression` * on the UCI AutoMPG dataset. * @see archive.ics.uci.edu/ml/datasets/Auto+MPG * > runMain scalation.modeling.example_AutoMPG_SimpleRegression */ @main def example_AutoMPG_SimpleRegression (): Unit = banner ("SimpleRegression model: y = b₀ + b₁*x₁") val mod = SimpleRegression (oxy) // create a SimpleRegression model mod.trainNtest ()() // train and test the model println (mod.summary ()) // produce summary statistics end example_AutoMPG_SimpleRegression //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** The `example_AutoMPG_Regression` main function performs `Regression` on the UCI * AutoMPG dataset. * @see archive.ics.uci.edu/ml/datasets/Auto+MPG * > runMain scalation.modeling.example_AutoMPG_Regression */ @main def example_AutoMPG_Regression (): Unit = banner ("AutoMPG Correlation Matrix") println (oxy.corr) banner ("Regression model: y = b₀ + b₁*x₁ + b₂*x₂ + b₃*x₃ + b₄*x₄ + b₅*x₅ + b₆*x₆") var mod = Regression (oxy, ox_fname)() // create a Regression Model (with intercept) mod.trainNtest ()() // train and test the model println (mod.summary ()) // produce summary statistics banner ("Regression model: y = b₀ + b₄*x₄ + b₆*x₆") mod = new Regression (x046, y, x046_fname) // create a Regression Model from columns 0, 4, 6 mod.trainNtest ()() // train and test the model println (mod.summary ()) // produce summary statistics end example_AutoMPG_Regression //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** The `example_AutoMPG_QuadRegression` main function performs `quadratic` on the UCI * AutoMPG dataset. * @see archive.ics.uci.edu/ml/datasets/Auto+MPG * > runMain scalation.modeling.example_AutoMPG_QuadRegression */ @main def example_AutoMPG_QuadRegression (): Unit = banner ("Quad Regression model: y = b₀ + b₄*x₄ + b₆*x₆ + b7*x4^2 + b8*x6^2") val mod = SymbolicRegression.quadratic (x46, y, x46_fname) // create a Quad Regression Model from columns 4, 6 mod.trainNtest ()() // train and test the model println (mod.summary ()) // produce summary statistics end example_AutoMPG_QuadRegression