diff --git a/notebook_1.ipynb b/notebook_1.ipynb index b904d73..ac7b6d6 100644 --- a/notebook_1.ipynb +++ b/notebook_1.ipynb @@ -44,25 +44,19 @@ "colab_type": "code", "colab": { "base_uri": "https://localhost:8080/", - "height": 136 + "height": 34 }, - "outputId": "96a9e0e9-310a-4987-fa67-b51a5f3e1e70" + "outputId": "2db93048-bf8d-44a0-da61-fcdb3eda475d" }, "source": [ "!git clone https://github.com/abdalazizrashid/AI-Feynman.git" ], - "execution_count": 1, + "execution_count": 57, "outputs": [ { "output_type": "stream", "text": [ - "Cloning into 'AI-Feynman'...\n", - "remote: Enumerating objects: 55, done.\u001b[K\n", - "remote: Counting objects: 100% (55/55), done.\u001b[K\n", - "remote: Compressing objects: 100% (38/38), done.\u001b[K\n", - "remote: Total 457 (delta 28), reused 35 (delta 16), pack-reused 402\u001b[K\n", - "Receiving objects: 100% (457/457), 31.31 MiB | 15.03 MiB/s, done.\n", - "Resolving deltas: 100% (276/276), done.\n" + "fatal: destination path 'AI-Feynman' already exists and is not an empty directory.\n" ], "name": "stdout" } @@ -75,14 +69,14 @@ "colab_type": "code", "colab": { "base_uri": "https://localhost:8080/", - "height": 289 + "height": 309 }, - "outputId": "aeba9212-e88b-42ef-88fc-a01ef7ccb428" + "outputId": "6548409e-dd85-4bfb-d633-a2747812ce5f" }, "source": [ "!pip install -r AI-Feynman/requirements.txt" ], - "execution_count": 2, + "execution_count": 58, "outputs": [ { "output_type": "stream", @@ -96,8 +90,8 @@ "Requirement already satisfied: sortedcontainers in /usr/local/lib/python3.6/dist-packages (from -r AI-Feynman/requirements.txt (line 7)) (2.2.2)\n", "Requirement already satisfied: tabulate in /usr/local/lib/python3.6/dist-packages (from -r AI-Feynman/requirements.txt (line 8)) (0.8.7)\n", "Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from torch->-r AI-Feynman/requirements.txt (line 1)) (0.16.0)\n", - "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->-r AI-Feynman/requirements.txt (line 3)) (1.2.0)\n", "Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->-r AI-Feynman/requirements.txt (line 3)) (2.8.1)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->-r AI-Feynman/requirements.txt (line 3)) (1.2.0)\n", "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib->-r AI-Feynman/requirements.txt (line 3)) (0.10.0)\n", "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->-r AI-Feynman/requirements.txt (line 3)) (2.4.7)\n", "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.6/dist-packages (from sympy->-r AI-Feynman/requirements.txt (line 4)) (1.1.0)\n", @@ -117,12 +111,12 @@ "base_uri": "https://localhost:8080/", "height": 153 }, - "outputId": "1bb047fd-13b1-49aa-de0c-4606d3c84ec3" + "outputId": "97fe04fc-c404-47b8-bec3-11d5cf321d19" }, "source": [ "!cd /content/AI-Feynman/Code/ && ./compile.sh && apt install -y parallel\n" ], - "execution_count": 14, + "execution_count": 59, "outputs": [ { "output_type": "stream", @@ -149,14 +143,14 @@ "base_uri": "https://localhost:8080/", "height": 34 }, - "outputId": "096ee2b1-bbe7-4b1b-f743-3e56ff8fe5ad" + "outputId": "ae513c97-4dfd-4528-edc5-c592ecc7caf0" }, "source": [ "import os\n", "os.chdir(\"/content/AI-Feynman/Code/\")\n", "print(os.getcwd())" ], - "execution_count": 4, + "execution_count": 8, "outputs": [ { "output_type": "stream", @@ -177,7 +171,7 @@ "source": [ "from S_run_aifeynman import run_aifeynman\n" ], - "execution_count": 5, + "execution_count": 61, "outputs": [] }, { @@ -920,7 +914,7 @@ " \"test_percentage\" : 0,\n", "}" ], - "execution_count": null, + "execution_count": 3, "outputs": [] }, { @@ -928,7 +922,11 @@ "metadata": { "id": "day8oRZd584P", "colab_type": "code", - "colab": {} + "colab": { + "base_uri": "https://localhost:8080/", + "height": 368 + }, + "outputId": "4652fd09-8150-420e-c46f-b628a3b395be" }, "source": [ "import logging\n", @@ -1015,8 +1013,22 @@ " self.print_results()\n", "\n" ], - "execution_count": 46, - "outputs": [] + "execution_count": 4, + "outputs": [ + { + "output_type": "error", + "ename": "ModuleNotFoundError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 17\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mS_run_aifeynman\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mrun_aifeynman\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 18\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 19\u001b[0m _CFG = {\n", + "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'S_run_aifeynman'", + "", + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0;32m\nNOTE: If your import is failing due to a missing package, you can\nmanually install dependencies using either !pip or !apt.\n\nTo view examples of installing some common dependencies, click the\n\"Open Examples\" button below.\n\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n" + ] + } + ] }, { "cell_type": "code", @@ -1034,9 +1046,14 @@ " yield dirs[i : i + chunks]\n", " yield dirs\n", "\n", - "files = list(get_files(Path(\"/content/Feynman_without_units\")))" + "files = list(get_files(Path(\"/content/Feynman_without_units\")))\n", + "\n", + "\n", + "with open(\"files.txt\", \"w\") as F:\n", + " for line in files[-1]:\n", + " F.write(f\"{line}\\n\")" ], - "execution_count": 47, + "execution_count": 5, "outputs": [] }, { @@ -1106,47 +1123,6 @@ } ] }, - { - "cell_type": "code", - "metadata": { - "id": "aVvrF83iPnuL", - "colab_type": "code", - "colab": { - "base_uri": "https://localhost:8080/", - "height": 306 - }, - "outputId": "5936cca3-9a00-4657-d382-99613c0d496a" - }, - "source": [ - "!parallel" - ], - "execution_count": 16, - "outputs": [ - { - "output_type": "stream", - "text": [ - "Academic tradition requires you to cite works you base your article on.\n", - "When using programs that use GNU Parallel to process data for publication\n", - "please cite:\n", - "\n", - " O. Tange (2011): GNU Parallel - The Command-Line Power Tool,\n", - " ;login: The USENIX Magazine, February 2011:42-47.\n", - "\n", - "This helps funding further development; AND IT WON'T COST YOU A CENT.\n", - "If you pay 10000 EUR you should feel free to use GNU Parallel without citing.\n", - "\n", - "To silence this citation notice: run 'parallel --citation'.\n", - "\n", - "parallel: Warning: Input is read from the terminal. You either know what you\n", - "parallel: Warning: are doing (in which case: YOU ARE AWESOME!) or you forgot\n", - "parallel: Warning: ::: or :::: or to pipe data into parallel. If so\n", - "parallel: Warning: consider going through the tutorial: man parallel_tutorial\n", - "parallel: Warning: Press CTRL-D to exit.\n" - ], - "name": "stdout" - } - ] - }, { "cell_type": "code", "metadata": { @@ -1669,6 +1645,108 @@ "[1327.5202240795804, 27.57798240828162, '0.0324957167678879*x0*x1**2 + 0.0954709145222299*x0*x1*x2 - 0.0518367881947689*x0*x1*x3 + 0.850311055415562*x0*x1 - 0.281598845270346*x0*x2**2 + 0.143093568988091*x0*x2*x3 + 0.827047248703045*x0*x2 + 0.0195647972984031*x0*x3**2 - 0.419409322578989*x0*x3 - 0.393857016024628*x0 - 0.0325007929091572*x1**3 - 0.124525299070793*x1**2*x2 + 0.0649419539246933*x1**2*x3 + 0.255889644781202*x1**2 - 0.295615544580811*x1*x2**2 + 0.238779807136057*x1*x2*x3 + 1.08861622104865*x1*x2 - 0.0388670663126931*x1*x3**2 - 0.453915765321264*x1*x3 - 0.650985290052454*x1 + 0.332150095352896*x2**3 - 0.0841340395633869*x2**2*x3 - 0.896533056720137*x2**2 - 0.114928272861219*x2*x3**2 + 0.275863468660905*x2*x3 - 0.435642558638502*x2 + 0.00642744864450299*x3**3 + 0.19934446687829*x3**2 - 0.198171936948463*x3 + 0.784697875310949']\n", "Checking for brute force + " ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "lwjXaAnL7q_0", + "colab_type": "text" + }, + "source": [ + "# Run on all files of the dataset" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "SNg_GwTF7rpB", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 935 + }, + "outputId": "b5eac008-4f8f-4980-dd8d-7d1ac386bb32" + }, + "source": [ + "%%time\n", + "!parallel --bar --ungroup --joblog ../../log.txt -t -j2 -a files.txt python generate_claimed_results.py --file" + ], + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Academic tradition requires you to cite works you base your article on.\n", + "When using programs that use GNU Parallel to process data for publication\n", + "please cite:\n", + "\n", + " O. Tange (2011): GNU Parallel - The Command-Line Power Tool,\n", + " ;login: The USENIX Magazine, February 2011:42-47.\n", + "\n", + "This helps funding further development; AND IT WON'T COST YOU A CENT.\n", + "If you pay 10000 EUR you should feel free to use GNU Parallel without citing.\n", + "\n", + "To silence this citation notice: run 'parallel --citation'.\n", + "\n", + "python generate_claimed_results.py --file II.13.23\n", + "python generate_claimed_results.py --file II.27.16\n", + "\u001b[7m\u001b[0m0% 0:100=0s II.27.16 \u001b[0mProcess PID: 8847 ---------------- Number of threads: 1\n", + "Process PID: 8848 ---------------- Number of threads: 1\n", + "\u001b[7m\u001b[0m0% 0:100=0s II.27.16 \u001b[0mChecking for brute force + \n", + "\n", + "Trying to solve mysteries with brute force...\n", + "Trying to solve /content/Feynman_without_units/II.27.16_train...\n", + "/bin/cp -p /content/Feynman_without_units/II.27.16_train mystery.dat\n", + "Number of variables..... 0\n", + "Functions used.......... +*-/><~\\RPSCLE\n", + " Arity 0 : P\n", + " Arity 1 : ><~\\RSCLE\n", + " Arity 2 : +*-/\n", + "Loading mystery data....\n", + "\u001b[7m\u001b[0m0% 0:100=0s II.27.16 \u001b[0m 1000000 rows read from file mystery.dat \n", + "Number of examples...... 1000000\n", + " Mystery data has largest magnitude 1.0000000000000000 at j= 1\n", + " Searching for best fit...\n", + " 0.000000000000 -2.141592741013 P 1 0.0000 0.0000 0.0000 0.0000\n", + " All done: results in results.dat \n", + "Checking for brute force * \n", + "\n", + "Trying to solve mysteries with brute force...\n", + "Trying to solve /content/Feynman_without_units/II.27.16_train...\n", + "/bin/cp -p /content/Feynman_without_units/II.27.16_train mystery.dat\n", + "Number of variables..... 0\n", + "Functions used.......... +*-/><~\\RPSCLE\n", + " Arity 0 : P\n", + " Arity 1 : ><~\\RSCLE\n", + " Arity 2 : +*-/\n", + "Loading mystery data....\n", + "\u001b[7m\u001b[0m0% 0:100=0s II.27.16 \u001b[0m 1000000 rows read from file mystery.dat \n", + "Number of examples...... 1000000\n", + " Mystery data has largest magnitude 1.0000000000000000 at j= 1\n", + " Searching for best fit...\n", + " 0.000000000000 0.318309877326 P 1 0.0000 0.0000 0.0000 0.0000\n", + " All done: results in results.dat \n", + "Checking polyfit \n", + "\n", + "\u001b[7m\u001b[0m0% 0:100=0s II.27.16 \u001b[0mComplexity RMSE Expression\n", + "\u001b[7m\u001b[0m0% 0:100=0s II.27.16 \u001b[0m" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "adbL8tHJ7s5a", + "colab_type": "code", + "colab": {} + }, + "source": [ + "" + ], + "execution_count": null, + "outputs": [] } ] } \ No newline at end of file