machinelearning

Machine learning code
git clone git://git.laack.co/machinelearning.git
Log | Files | Refs

MAE.ipynb (1175B)


      1 {
      2  "cells": [
      3   {
      4    "cell_type": "code",
      5    "execution_count": 1,
      6    "metadata": {},
      7    "outputs": [],
      8    "source": [
      9     "# Often you would use ordered pairs for expected and inference.\n",
     10     "expected = [10, 10, 4, 3, 2, 4, 5, 5]\n",
     11     "inference = [9 , 7, 3, 2, 1, 3, 2, 5]"
     12    ]
     13   },
     14   {
     15    "cell_type": "code",
     16    "execution_count": 4,
     17    "metadata": {},
     18    "outputs": [
     19     {
     20      "name": "stdout",
     21      "output_type": "stream",
     22      "text": [
     23       "1.375\n"
     24      ]
     25     }
     26    ],
     27    "source": [
     28     "count = 0\n",
     29     "total = 0\n",
     30     "while count < len(expected):\n",
     31     "    total +=  abs(expected[count] - inference[count])\n",
     32     "    count += 1\n",
     33     "\n",
     34     "total = total / len(expected)\n",
     35     "print(total)"
     36    ]
     37   }
     38  ],
     39  "metadata": {
     40   "kernelspec": {
     41    "display_name": "notebook",
     42    "language": "python",
     43    "name": "notebook"
     44   },
     45   "language_info": {
     46    "codemirror_mode": {
     47     "name": "ipython",
     48     "version": 3
     49    },
     50    "file_extension": ".py",
     51    "mimetype": "text/x-python",
     52    "name": "python",
     53    "nbconvert_exporter": "python",
     54    "pygments_lexer": "ipython3",
     55    "version": "3.11.2"
     56   }
     57  },
     58  "nbformat": 4,
     59  "nbformat_minor": 2
     60 }