MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Visual_network_topoloy",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "9": {
                "pageid": 9,
                "ns": 0,
                "title": "Selling Icecreams",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "== FAQ ==\n\nFor information about dat-files have a view to the [[FAQ]] page.\n\n== Training ==\n\n<source lang=\"php\">\n\nrequire_once 'ANN/Loader.php';\n\nuse ANN\\Network;\nuse ANN\\InputValue;\nuse ANN\\OutputValue;\nuse ANN\\Values;\n\ntry\n{\n  $objNetwork = Network::loadFromFile('icecreams.dat');\n}\ncatch(Exception $e)\n{\n  print 'Creating a new one...';\n\t\n  $objNetwork = new Network(2, 5, 1);\n\n\n  $objTemperature = new InputValue(-15, 50); // Temperature in Celsius\n\n  $objTemperature->saveToFile('input_temperature.dat');\n  \n\n  $objHumidity    = new InputValue(0, 100);  // Humidity percentage\n\n  $objHumidity->saveToFile('input_humidity.dat');\n\n\n  $objIcecream    = new OutputValue(0, 300); // Quantity of sold ice-creams\n\n  $objIcecream->saveToFile('output_quantity.dat');\n\n\n  $objValues = new Values;\n\n  $objValues->train()\n            ->input(\n                   $objTemperature->getInputValue(20),\n                   $objHumidity->getInputValue(10)\n                   )\n            ->output(\n                   $objIcecream->getOutputValue(20)\n                   )\n            ->input(\n                   $objTemperature->getInputValue(30),\n                   $objHumidity->getInputValue(40)\n                   )\n            ->output(\n                   $objIcecream->getOutputValue(90)\n                   )\n            ->input(\n                   $objTemperature->getInputValue(32),\n                   $objHumidity->getInputValue(30)\n                   )\n            ->output(\n                   $objIcecream->getOutputValue(70)\n                   )\n            ->input(\n                   $objTemperature->getInputValue(33),\n                   $objHumidity->getInputValue(20)\n                   )\n            ->output(\n                   $objIcecream->getOutputValue(75)\n                   );\n\n  $objValues->saveToFile('values_icecreams.dat');\n  \n  unset($objValues);\n  unset($objTemperature);\n  unset($objHumidity);\n  unset($objIcecream);\n}\n\ntry\n{\n  $objTemperature = InputValue::loadFromFile('input_temperature.dat'); // Temperature in Celsius\n\n  $objHumidity    = InputValue::loadFromFile('input_humidity.dat'); // Humidity percentage\n\n  $objIcecream    = OutputValue::loadFromFile('output_quantity.dat'); // Quantity of sold ice-creams\n}\ncatch(Exception $e)\n{\n  die('Error loading value objects');\n}\n\ntry\n{\n  $objValues = Values::loadFromFile('values_icecreams.dat');\n}\ncatch(Exception $e)\n{\n  die('Loading of values failed');\n}\n\n$objNetwork->setValues($objValues); // to be called as of version 2.0.6\n\n$boolTrained = $objNetwork->train();\n\nprint ($boolTrained)\n        ? 'Network trained'\n        : 'Network not trained completely. Please re-run the script';\n\n$objNetwork->saveToFile('icecreams.dat');\n\n$objNetwork->printNetwork();\n</source>\n\n== Using trained network ==\n\n<source lang=\"php\">\n\nrequire_once 'ANN/Loader.php';\n\nuse ANN\\Network;\nuse ANN\\InputValue;\nuse ANN\\OutputValue;\nuse ANN\\Values;\n\ntry\n{\n  $objNetwork = Network::loadFromFile('icecreams.dat');\n}\ncatch(Exception $e)\n{\n  die('Network not found');\n}\n\ntry\n{\n  $objTemperature = InputValue::loadFromFile('input_temperature.dat'); // Temperature in Celsius\n\n  $objHumidity    = InputValue::loadFromFile('input_humidity.dat');    // Humidity percentage\n\n  $objIcecream    = OutputValue::loadFromFile('output_quantity.dat');  // Quantity of sold ice-creams\n}\ncatch(Exception $e)\n{\n  die('Error loading value objects');\n}\n\ntry\n{\n  $objValues = Values::loadFromFile('values_icecreams.dat');\n}\ncatch(Exception $e)\n{\n  die('Loading of values failed');\n}\n\n$objValues->input( // input values appending the loaded ones\n                 $objTemperature->getInputValue(17),\n                 $objHumidity->getInputValue(12)\n                 )\n          ->input(\n                 $objTemperature->getInputValue(31),\n                 $objHumidity->getInputValue(42)\n                 )\n          ->input(\n                 $objTemperature->getInputValue(31),\n                 $objHumidity->getInputValue(34)\n                 )\n          ->input(\n                 $objTemperature->getInputValue(34),\n                 $objHumidity->getInputValue(21)\n                 );\n\n$objNetwork->setValues($objValues);\n\n$arrOutputs = $objNetwork->getOutputs();\n\nforeach($arrOutputs as $arrOutput)\n  foreach($arrOutput as $floatOutput)\n    print $objIcecream->getRealOutputValue($floatOutput). '<br />';\n\n</source>"
                    }
                ]
            },
            "23": {
                "pageid": 23,
                "ns": 0,
                "title": "Using date input support class",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "== FAQ ==\n\nFor information about dat-files have a view to the [[FAQ]] page.\n\n== XML for holidays ==\n\nThe standard filename is ''Holidays.xml'' but can be changed by calling ANN_DateInputs::setHolidaysFilename().\n\n<source lang=\"xml\">\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<holidays>\n\t<holiday>\n\t\t<day>1</day>\n\t\t<month>1</month>\n\t\t<year>any</year>\n\t\t<country>Germany</country>\n\t\t<state>any</state>\n\t\t<description>New Year</description>\n\t</holiday>\n\t<holiday>\n\t\t<day>24</day>\n\t\t<month>12</month>\n\t\t<year>any</year>\n\t\t<country>Germany</country>\n\t\t<state>any</state>\n\t\t<description>Christmas</description>\n\t</holiday>\n</holidays>\n\n</source>\n\n== Training ==\n\n<source lang=\"php\">\n\nrequire_once 'ANN/Loader.php';\n\ntry\n{\n  $objNetwork = ANN_Network::loadFromFile('icecreams.dat');\n}\ncatch(Exception $e)\n{\n  print 'Creating a new one...';\n\t\n  $objNetwork = new ANN_Network(2, 8, 1);\n\n\n  $objDateInput = new ANN_DateInputs('2010-01-03'); // As of ANN 2.1.3\n\n\n  $objTemperature = new ANN_InputValue(-15, 50); // Temperature in Celsius\n\n  $objTemperature->saveToFile('input_temperature.dat');\n  \n\n  $objHumidity    = new ANN_InputValue(0, 100);  // Humidity percentage\n\n  $objHumidity->saveToFile('input_humidity.dat');\n\n\n  $objIcecream    = new ANN_OutputValue(0, 300); // Quantity of sold ice-creams\n\n  $objIcecream->saveToFile('output_quantity.dat');\n\n\n  $objValues = new ANN_Values;\n\n  $objValues->train()\n            ->input(\n                   $objTemperature->getInputValue(20),\n                   $objHumidity->getInputValue(10),\n                   $objDateInput->getHolidaysInWeek() // As of ANN 2.1.3\n                   )\n            ->output(\n                   $objIcecream->getOutputValue(20)\n                   )\n            ->input(\n                   $objTemperature->getInputValue(30),\n                   $objHumidity->getInputValue(40),\n                   $objDateInput->getHolidaysInWeek()\n                   )\n            ->output(\n                   $objIcecream->getOutputValue(90)\n                   )\n            ->input(\n                   $objTemperature->getInputValue(32),\n                   $objHumidity->getInputValue(30),\n                   $objDateInput->getHolidaysInWeek()\n                   )\n            ->output(\n                   $objIcecream->getOutputValue(70)\n                   )\n            ->input(\n                   $objTemperature->getInputValue(33),\n                   $objHumidity->getInputValue(20),\n                   $objDateInput->getHolidaysInWeek()\n                   )\n            ->output(\n                   $objIcecream->getOutputValue(75)\n                   );\n\n  $objValues->saveToFile('values_icecreams.dat');\n  \n  unset($objValues);\n  unset($objTemperature);\n  unset($objHumidity);\n  unset($objIcecream);\n}\n\ntry\n{\n  $objTemperature = ANN_InputValue::loadFromFile('input_temperature.dat'); // Temperature in Celsius\n\n  $objHumidity    = ANN_InputValue::loadFromFile('input_humidity.dat'); // Humidity percentage\n\n  $objIcecream    = ANN_OutputValue::loadFromFile('output_quantity.dat'); // Quantity of sold ice-creams\n}\ncatch(Exception $e)\n{\n  die('Error loading value objects');\n}\n\ntry\n{\n  $objValues = ANN_Values::loadFromFile('values_icecreams.dat');\n}\ncatch(Exception $e)\n{\n  die('Loading of values failed');\n}\n\n$objNetwork->setValues($objValues); // As of ANN 2.0.6\n\n$boolTrained = $objNetwork->train();\n\nprint ($boolTrained)\n        ? 'Network trained'\n        : 'Network not trained completely. Please re-run the script';\n\n$objNetwork->saveToFile('icecreams.dat');\n\n$objNetwork->printNetwork();\n</source>"
                    }
                ]
            }
        }
    }
}