Created
January 14, 2013 18:21
-
-
Save margusmartsepp/4532104 to your computer and use it in GitHub Desktop.
AI hw 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 21public static class ZooNNDataSet extends NNDataSet { | |
| @Override | |
| public void setTargetColumns() { | |
| targetColumnNumbers = new ArrayList<Integer>(); | |
| int size = nds.get(0).size(); | |
| targetColumnNumbers.add(size - 1); // last column | |
| targetColumnNumbers.add(size - 2); // last but one column | |
| targetColumnNumbers.add(size - 3); // and the one before that | |
| } | |
| } | |
| public static class ZooDataSetNumerizer implements Numerizer { | |
| @Override | |
| public Pair<List<Double>, List<Double>> numerize(Example e) { | |
| List<Double> input = new ArrayList<Double>(); | |
| List<Double> desiredOutput = new ArrayList<Double>(); | |
| double a2 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a3 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a4 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a5 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a6 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a7 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a8 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a9 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a10 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a11 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a12 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a13 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a14 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a15 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a16 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| double a17 = Double.parseDouble(e.getAttributeValueAsString("a2")); | |
| input.add(a2); | |
| input.add(a3); | |
| input.add(a4); | |
| input.add(a5); | |
| input.add(a6); | |
| input.add(a7); | |
| input.add(a8); | |
| input.add(a9); | |
| input.add(a10); | |
| input.add(a11); | |
| input.add(a12); | |
| input.add(a13); | |
| input.add(a14); | |
| input.add(a15); | |
| input.add(a16); | |
| input.add(a17); | |
| String plant_category_string = e.getAttributeValueAsString("a18"); | |
| desiredOutput = convertCategoryToListOfDoubles(plant_category_string); | |
| Pair<List<Double>, List<Double>> io = new Pair<List<Double>, List<Double>>( | |
| input, desiredOutput); | |
| return io; | |
| } | |
| private List<Double> convertCategoryToListOfDoubles( | |
| String zoo_category_string) { | |
| if (zoo_category_string.equals("amphibian")) { | |
| return Arrays.asList(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0); | |
| } else if (zoo_category_string.equals("insect")) { | |
| return Arrays.asList(0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); | |
| } else if (zoo_category_string.equals("mammal")) { | |
| return Arrays.asList(0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0); | |
| } else if (zoo_category_string.equals("bird")) { | |
| return Arrays.asList(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0); | |
| } else if (zoo_category_string.equals("shellfish")) { | |
| return Arrays.asList(0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0); | |
| } else if (zoo_category_string.equals("fish")) { | |
| return Arrays.asList(0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0); | |
| } else if (zoo_category_string.equals("reptile")) { | |
| return Arrays.asList(1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | |
| } else { | |
| throw new RuntimeException("invalid plant category"); | |
| } | |
| } | |
| @Override | |
| public String denumerize(List<Double> outputValue) { | |
| List<Double> rounded = new ArrayList<Double>(); | |
| for (Double d : outputValue) { | |
| rounded.add(round(d)); | |
| } | |
| if (rounded | |
| .equals(Arrays.asList(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0))) { | |
| return "amphibian"; | |
| } else if (rounded.equals(Arrays.asList(0.0, 0.0, 0.0, 0.0, 0.0, | |
| 1.0, 0.0))) { | |
| return "insect"; | |
| } else if (rounded.equals(Arrays.asList(0.0, 0.0, 0.0, 0.0, 1.0, | |
| 0.0, 0.0))) { | |
| return "mammal"; | |
| } else if (rounded.equals(Arrays.asList(0.0, 0.0, 0.0, 1.0, 0.0, | |
| 0.0, 0.0))) { | |
| return "bird"; | |
| } else if (rounded.equals(Arrays.asList(0.0, 0.0, 1.0, 0.0, 0.0, | |
| 0.0, 0.0))) { | |
| return "shellfish"; | |
| } else if (rounded.equals(Arrays.asList(0.0, 1.0, 0.0, 0.0, 0.0, | |
| 0.0, 0.0))) { | |
| return "fish"; | |
| } else if (rounded.equals(Arrays.asList(1.0, 0.0, 0.0, 0.0, 0.0, | |
| 0.0, 0.0))) { | |
| return "reptile"; | |
| } else { | |
| return "unknown"; | |
| } | |
| } | |
| private double round(Double d) { | |
| if (d < 0) { | |
| return 0.0; | |
| } | |
| if (d > 1) { | |
| return 1.0; | |
| } else { | |
| return Math.round(d); | |
| } | |
| } | |
| } | |
| public static void backPropogation2() { | |
| try { | |
| DataSet irisDataSet = DataSetFactory.getIrisDataSet(); | |
| Numerizer numerizer = new IrisDataSetNumerizer(); | |
| NNDataSet innds = new IrisNNDataSet(); | |
| innds.createExamplesFromDataSet(irisDataSet, numerizer); | |
| innds.refreshDataset(); | |
| ArrayList<Integer> results = new ArrayList<Integer>(); | |
| for (int i = 3; i < 151; i++) { | |
| DataSet ds1 = new DataSetFactory().fromFile("iris_" + i, | |
| DataSetFactory.createIrisDataSetSpec(), ","); | |
| NNDataSet nds1 = new IrisNNDataSet(); | |
| nds1.createExamplesFromDataSet(ds1, numerizer); | |
| NNConfig config = new NNConfig(); | |
| config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_INPUTS, 4); | |
| config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_OUTPUTS, 3); | |
| config.setConfig( | |
| FeedForwardNeuralNetwork.NUMBER_OF_HIDDEN_NEURONS, 6); | |
| config.setConfig(FeedForwardNeuralNetwork.LOWER_LIMIT_WEIGHTS, | |
| -2.0); | |
| config.setConfig(FeedForwardNeuralNetwork.UPPER_LIMIT_WEIGHTS, | |
| 2.0); | |
| FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork( | |
| config); | |
| ffnn.setTrainingScheme(new BackPropLearning(0.01, 0.95)); | |
| ffnn.trainOn(nds1, i); | |
| nds1.refreshDataset(); | |
| int[] result = ffnn.testOnDataSet(innds); | |
| results.add(result[0]); | |
| } | |
| System.out.println(results.toString()); | |
| } catch (Exception e) { | |
| e.printStackTrace(); | |
| } | |
| } | |
| public static void backPropogation() throws Exception { | |
| Numerizer numerizer = new ZooDataSetNumerizer(); | |
| DataSetSpecification spec = new DataSetSpecification(); | |
| spec.defineStringAttribute("a2", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a3", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a4", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a5", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a6", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a7", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a8", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a9", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a10", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a11", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a12", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a13", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a14", new String[] { "0", "2", "4", "5", | |
| "6", "8" }); | |
| spec.defineStringAttribute("a15", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a16", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a17", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a18", new String[] { "amphibian", "bird", | |
| "fish", "insect", "mammal", "reptile", "shellfish" }); | |
| DataSet ds2 = new DataSetFactory().fromFile("zoo_101", spec, ","); | |
| NNDataSet nds2 = new ZooNNDataSet(); | |
| nds2.createExamplesFromDataSet(ds2, numerizer); | |
| nds2.refreshDataset(); | |
| ArrayList<Integer> results = new ArrayList<Integer>(); | |
| for (int i = 7; i < 102; i++) { | |
| DataSet ds1 = new DataSetFactory().fromFile("zoo_" + i, spec, ","); | |
| NNDataSet nds1 = new ZooNNDataSet(); | |
| nds1.createExamplesFromDataSet(ds1, numerizer); | |
| NNConfig config = new NNConfig(); | |
| config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_INPUTS, 17); | |
| config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_OUTPUTS, 16); | |
| config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_HIDDEN_NEURONS, | |
| 20); | |
| config.setConfig(FeedForwardNeuralNetwork.LOWER_LIMIT_WEIGHTS, | |
| -0.001); | |
| config.setConfig(FeedForwardNeuralNetwork.UPPER_LIMIT_WEIGHTS, | |
| 0.001); | |
| FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork(config); | |
| ffnn.setTrainingScheme(new BackPropLearning(0.01, 0.95)); | |
| ffnn.trainOn(nds1, 100); | |
| nds1.refreshDataset(); | |
| int[] result = ffnn.testOnDataSet(nds2); | |
| results.add(result[0]); | |
| } | |
| System.out.println(results.toString()); | |
| } | |
| public static void decisionTree2() throws Exception { | |
| DataSetSpecification spec = new DataSetSpecification(); | |
| spec.defineStringAttribute("a1", new String[] { "4", "5", "6", "7" }); | |
| spec.defineStringAttribute("a2", new String[] { "2", "3", "4" }); | |
| spec.defineStringAttribute("a3", new String[] { "1", "3", "4", "5", "6" }); | |
| spec.defineStringAttribute("a4", new String[] { "0", "1", "2" }); | |
| spec.defineStringAttribute("a5", new String[] { "Floor[\"setosa\"]", "Floor[\"versicolor\"]", "Floor[\"virginica\"]" }); | |
| DataSet ds2 = new DataSetFactory().fromFile("iris_150", spec, ","); | |
| DecisionTreeLearner learner2 = new DecisionTreeLearner(); | |
| learner2.train(ds2); | |
| System.out.println(learner2.getDecisionTree()); | |
| for (int i = 3; i < 150; i++) { | |
| DataSet ds1 = new DataSetFactory().fromFile("iris_" + i, spec, ","); | |
| DecisionTreeLearner learner = new DecisionTreeLearner(); | |
| learner.train(ds1); | |
| int[] result = learner.test(ds2); | |
| System.out.print("" + result[0] + ", "); | |
| } | |
| } | |
| public static void decisionTree() throws Exception { | |
| DataSetSpecification spec = new DataSetSpecification(); | |
| spec.defineStringAttribute("a2", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a3", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a4", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a5", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a6", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a7", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a8", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a9", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a10", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a11", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a12", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a13", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a14", new String[] { "0", "2", "4", "5", | |
| "6", "8" }); | |
| spec.defineStringAttribute("a15", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a16", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a17", new String[] { "0", "1" }); | |
| spec.defineStringAttribute("a18", new String[] { "amphibian", "bird", | |
| "fish", "insect", "mammal", "reptile", "shellfish" }); | |
| DataSet ds2 = new DataSetFactory().fromFile("zoo_101", spec, ","); | |
| for (int i = 7; i < 102; i++) { | |
| DataSet ds1 = new DataSetFactory().fromFile("zoo_" + i, spec, ","); | |
| DecisionTreeLearner learner = new DecisionTreeLearner(); | |
| learner.train(ds1); | |
| int[] result = learner.test(ds2); | |
| System.out.print("" + result[0] + ", "); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 21private DecisionTree decisionTreeLearning(DataSet ds, | |
| List<String> attributeNames, ConstantDecisonTree defaultTree) { | |
| if (ds.size() == 0) { | |
| return defaultTree; | |
| } | |
| if (allExamplesHaveSameClassification(ds)) { | |
| return new ConstantDecisonTree(ds.getExample(0).targetValue()); | |
| } | |
| if (attributeNames.size() == 0) { | |
| return majorityValue(ds); | |
| } | |
| String chosenAttribute = chooseAttribute(ds, attributeNames); | |
| DecisionTree tree = new DecisionTree(chosenAttribute); | |
| ConstantDecisonTree m = majorityValue(ds); | |
| List<String> values = ds.getPossibleAttributeValues(chosenAttribute); | |
| for (String v : values) { | |
| DataSet filtered = ds.matchingDataSet(chosenAttribute, v); | |
| List<String> newAttribs = Util.removeFrom(attributeNames, | |
| chosenAttribute); | |
| DecisionTree subTree = decisionTreeLearning(filtered, newAttribs, m); | |
| tree.addNode(v, subTree); | |
| } | |
| return tree; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rs = {{26, 25, 39, 56, 31, 93, 90, 100, 56, 118, 120, 117, 135, 123, | |
| 132, 121, 128, 121, 122, 124, 128, 120, 140, 124, 124, 131, 132, | |
| 124, 115, 139, 124, 136, 127, 136, 141, 126, 136, 144, 138, 123, | |
| 139, 144, 144, 129, 137, 144, 133, 148, 140, 147, 145, 144, 147, | |
| 145, 139, 145, 145, 145, 144, 145, 146, 145, 144, 146, 145, 146, | |
| 137, 143, 143, 143, 142, 147, 145, 147, 146, 147, 145, 146, 147, | |
| 146, 145, 146, 145, 148, 143, 146, 146, 145, 146, 145, 148, 146, | |
| 140, 145, 147, 148, 147, 145, 148, 146, 145, 148, 146, 145, 148, | |
| 147, 146, 147, 146, 147, 146, 146, 145, 144, 146, 145, 147, 146, | |
| 146, 145, 144, 146, 146, 147, 147, 145, 148, 145, 147, 147, 147, | |
| 146, 146, 147, 146, 147, 147, 146, 148, 146, 147, 147, 147, 148, | |
| 146, 146, 146, 148}, {19, 13, 53, 49, 60, 66, 61, 62, 71, 123, | |
| 116, 120, 111, 114, 132, 117, 120, 136, 121, 127, 128, 119, 123, | |
| 118, 125, 129, 113, 136, 131, 134, 112, 144, 124, 133, 134, 139, | |
| 128, 144, 131, 117, 144, 136, 143, 131, 130, 144, 140, 139, 143, | |
| 146, 141, 144, 147, 146, 141, 144, 136, 145, 147, 144, 147, 144, | |
| 145, 146, 143, 145, 131, 144, 140, 140, 142, 146, 144, 148, 146, | |
| 145, 143, 146, 147, 147, 146, 146, 145, 146, 145, 145, 147, 145, | |
| 147, 145, 146, 146, 141, 145, 146, 147, 148, 145, 148, 146, 145, | |
| 148, 146, 145, 148, 147, 145, 147, 145, 146, 145, 146, 145, 144, | |
| 146, 146, 147, 148, 145, 146, 144, 146, 146, 147, 145, 146, 148, | |
| 146, 147, 147, 146, 147, 146, 148, 147, 146, 146, 147, 146, 147, | |
| 147, 146, 146, 147, 147, 147, 147, 146}, {84, 51, 15, 42, 101, | |
| 114, 99, 109, 112, 84, 123, 126, 125, 117, 124, 117, 115, 122, | |
| 123, 117, 122, 124, 127, 131, 123, 118, 131, 133, 117, 120, 135, | |
| 143, 129, 138, 136, 143, 124, 140, 141, 123, 139, 142, 144, 131, | |
| 141, 124, 143, 145, 141, 143, 146, 144, 145, 145, 144, 147, 146, | |
| 145, 144, 143, 146, 143, 146, 146, 143, 146, 131, 146, 142, 138, | |
| 141, 146, 145, 146, 147, 146, 142, 147, 145, 147, 145, 145, 145, | |
| 146, 146, 145, 146, 146, 148, 145, 148, 145, 142, 145, 148, 146, | |
| 148, 145, 145, 146, 148, 144, 146, 145, 147, 146, 145, 146, 146, | |
| 148, 145, 146, 145, 145, 144, 145, 148, 147, 145, 146, 146, 146, | |
| 145, 146, 145, 146, 148, 144, 148, 147, 147, 146, 146, 147, 147, | |
| 147, 146, 147, 146, 147, 147, 146, 146, 147, 147, 146, 146, | |
| 147}, {52, 81, 82, 15, 58, 75, 84, 124, 109, 101, 124, 117, 123, | |
| 112, 123, 121, 109, 123, 125, 129, 124, 122, 129, 125, 124, 124, | |
| 124, 146, 126, 134, 138, 130, 130, 131, 131, 139, 142, 139, 138, | |
| 123, 143, 138, 144, 136, 142, 142, 142, 144, 144, 146, 142, 144, | |
| 143, 148, 142, 146, 144, 145, 143, 144, 144, 145, 143, 145, 145, | |
| 146, 132, 144, 146, 140, 141, 144, 144, 147, 146, 148, 146, 146, | |
| 148, 147, 145, 144, 145, 146, 143, 145, 145, 144, 147, 145, 145, | |
| 146, 141, 145, 147, 148, 148, 145, 147, 146, 145, 147, 146, 145, | |
| 145, 147, 146, 147, 146, 148, 146, 146, 145, 144, 144, 145, 147, | |
| 146, 145, 146, 144, 145, 146, 147, 145, 147, 148, 145, 146, 147, | |
| 146, 147, 147, 147, 146, 146, 147, 146, 146, 147, 147, 147, 147, | |
| 147, 146, 146, 147, 146}, {33, 50, 41, 25, 29, 102, 82, 128, 98, | |
| 113, 129, 101, 125, 128, 134, 121, 124, 140, 130, 134, 118, 123, | |
| 132, 121, 131, 130, 138, 139, 126, 131, 137, 138, 127, 131, 122, | |
| 135, 126, 140, 145, 121, 136, 134, 144, 131, 143, 142, 145, 147, | |
| 141, 147, 133, 140, 147, 146, 146, 146, 146, 145, 145, 133, 147, | |
| 143, 144, 144, 147, 145, 135, 144, 145, 144, 142, 146, 144, 146, | |
| 146, 146, 143, 147, 147, 146, 146, 146, 145, 144, 143, 145, 145, | |
| 145, 148, 144, 146, 146, 143, 145, 148, 146, 148, 145, 147, 145, | |
| 147, 144, 146, 145, 147, 147, 146, 145, 146, 148, 146, 145, 146, | |
| 145, 146, 145, 147, 148, 146, 146, 145, 145, 145, 146, 146, 146, | |
| 148, 145, 147, 147, 147, 147, 147, 148, 147, 147, 146, 146, 147, | |
| 147, 146, 146, 147, 146, 146, 147, 147, 147}, {73, 72, 61, 4, | |
| 103, 70, 80, 82, 109, 125, 106, 120, 119, 125, 121, 120, 128, | |
| 140, 122, 127, 116, 123, 132, 133, 123, 120, 129, 133, 125, 134, | |
| 122, 127, 122, 138, 141, 142, 134, 138, 121, 127, 140, 131, 144, | |
| 123, 144, 146, 139, 142, 141, 144, 143, 142, 141, 145, 143, 147, | |
| 146, 146, 147, 145, 144, 144, 144, 145, 148, 144, 128, 142, 145, | |
| 142, 142, 146, 146, 146, 145, 147, 144, 144, 146, 147, 144, 146, | |
| 145, 146, 146, 145, 146, 145, 148, 147, 147, 146, 142, 145, 145, | |
| 147, 148, 145, 148, 145, 148, 143, 146, 145, 145, 146, 145, 146, | |
| 146, 148, 146, 145, 145, 145, 145, 146, 147, 146, 146, 147, 145, | |
| 146, 146, 147, 146, 147, 148, 144, 147, 147, 148, 148, 146, 147, | |
| 147, 146, 145, 146, 146, 147, 146, 146, 146, 147, 147, 146, 146, | |
| 145}, | |
| {38, 50, 4, 37, 40, 80, 82, 92, 97, 116, 125, 123, 127, 113, 125, | |
| 122, 114, 130, 124, 123, 126, 120, 131, 123, 125, 120, 118, 83, | |
| 126, 128, 131, 141, 125, 138, 128, 141, 129, 132, 132, 126, 142, | |
| 133, 144, 130, 146, 146, 146, 145, 142, 139, 143, 144, 134, 146, | |
| 141, 144, 144, 146, 146, 144, 145, 144, 146, 147, 146, 146, 128, | |
| 141, 143, 142, 142, 146, 145, 147, 144, 148, 146, 147, 146, 146, | |
| 145, 145, 145, 144, 145, 145, 147, 145, 148, 145, 145, 145, 143, | |
| 145, 145, 146, 148, 147, 148, 146, 146, 146, 147, 145, 148, 147, | |
| 146, 146, 146, 148, 146, 146, 145, 145, 144, 145, 147, 146, 145, | |
| 146, 145, 146, 145, 146, 145, 146, 148, 146, 145, 147, 146, 146, | |
| 146, 147, 146, 147, 146, 146, 147, 146, 146, 147, 147, 147, 147, | |
| 146, 146, 147}, | |
| {50, 2, 57, 64, 119, 105, 101, 105, 123, 124, 114, 126, 127, 114, | |
| 133, 125, 109, 125, 119, 126, 126, 117, 134, 124, 124, 126, 121, | |
| 104, 130, 139, 124, 125, 127, 136, 144, 132, 132, 136, 144, 122, | |
| 134, 122, 147, 120, 136, 147, 142, 146, 131, 145, 141, 144, 144, | |
| 144, 145, 147, 144, 144, 144, 144, 144, 144, 147, 146, 148, 145, | |
| 134, 143, 140, 140, 142, 146, 146, 148, 144, 146, 145, 147, 148, | |
| 147, 144, 146, 145, 146, 143, 145, 145, 145, 148, 145, 145, 146, | |
| 140, 145, 148, 144, 147, 145, 148, 146, 146, 147, 146, 145, 147, | |
| 147, 145, 146, 146, 145, 146, 145, 146, 145, 145, 145, 147, 146, | |
| 146, 146, 146, 146, 145, 145, 146, 147, 148, 144, 147, 146, 147, | |
| 145, 145, 147, 147, 146, 146, 146, 146, 147, 147, 146, 147, 147, | |
| 147, 145, 146, 147}, | |
| {50, 50, 59, 71, 54, 108, 82, 75, 98, 91, 126, 120, 114, 126, 125, | |
| 117, 118, 113, 115, 138, 124, 122, 122, 121, 124, 115, 138, 143, | |
| 123, 121, 139, 138, 114, 128, 126, 139, 134, 129, 143, 128, 146, | |
| 142, 144, 134, 142, 145, 128, 145, 143, 147, 142, 145, 148, 146, | |
| 145, 145, 145, 145, 147, 145, 142, 145, 145, 144, 147, 146, 131, | |
| 143, 143, 140, 141, 146, 145, 148, 146, 147, 143, 147, 148, 147, | |
| 146, 146, 145, 148, 143, 145, 146, 145, 147, 145, 145, 146, 140, | |
| 145, 145, 146, 148, 145, 148, 146, 145, 143, 148, 145, 148, 147, | |
| 146, 146, 145, 148, 146, 146, 145, 145, 144, 145, 147, 146, 145, | |
| 146, 144, 146, 144, 146, 146, 147, 148, 145, 147, 147, 145, 148, | |
| 147, 147, 147, 147, 146, 146, 146, 147, 146, 146, 147, 147, 147, | |
| 146, 147, 147}, | |
| {3, 46, 75, 59, 99, 97, 100, 100, 108, 91, 110, 106, 118, 131, | |
| 121, 121, 109, 118, 116, 119, 114, 118, 124, 130, 119, 132, 133, | |
| 138, 132, 123, 130, 119, 123, 138, 134, 130, 120, 138, 124, 124, | |
| 129, 140, 143, 129, 138, 144, 143, 142, 137, 138, 144, 143, 146, | |
| 144, 145, 147, 144, 144, 145, 134, 146, 144, 148, 144, 146, 145, | |
| 134, 145, 140, 144, 141, 147, 144, 148, 146, 147, 145, 147, 145, | |
| 147, 143, 146, 145, 146, 143, 144, 146, 145, 146, 144, 145, 146, | |
| 142, 145, 145, 147, 148, 145, 148, 145, 146, 145, 146, 145, 145, | |
| 148, 145, 147, 146, 148, 146, 146, 145, 145, 144, 145, 147, 146, | |
| 145, 146, 146, 146, 145, 146, 146, 147, 148, 145, 148, 147, 148, | |
| 147, 147, 147, 146, 148, 146, 147, 146, 147, 147, 146, 147, 147, | |
| 146, 147, 146, 147} | |
| }/150; | |
| r = Mean[#] & /@ Transpose[rs] | |
| kl = ListInterpolation[r, InterpolationOrder -> 0][x] | |
| kr = Fit[Transpose[{Range[1, Length[r]], r}], {1, x^2, Sqrt[x], | |
| Log[E, x], x}, x] | |
| u = Show[ListPlot[{r // N}, Filling -> Axis, | |
| PlotRange -> {0.0, 1.01}], | |
| Plot[{kl, kr}, {x, 0, 150 - 3}, PlotPoints -> 200, | |
| PlotRange -> {0, 1}, Filling -> {1 -> {2}}]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment