Fossil SCM
Polishing pass on www/collisions.ipynb: improved docs, simplified the "sd" parameter as "spread", removed an empty cell, and renumbered the cells.
Commit
847423edfaae1dd2d9baa767b95194f12cc700c94b595ba8f3372a73d7b158d7
Parent
66d55e9b436c203…
1 file changed
+28
-26
+28
-26
| --- www/collisions.ipynb | ||
| +++ www/collisions.ipynb | ||
| @@ -2,11 +2,11 @@ | ||
| 2 | 2 | "cells": [ |
| 3 | 3 | { |
| 4 | 4 | "cell_type": "markdown", |
| 5 | 5 | "metadata": {}, |
| 6 | 6 | "source": [ |
| 7 | - "Pull in the packages we need" | |
| 7 | + "*Pull in the packages we need:*" | |
| 8 | 8 | ] |
| 9 | 9 | }, |
| 10 | 10 | { |
| 11 | 11 | "cell_type": "code", |
| 12 | 12 | "execution_count": 1, |
| @@ -25,50 +25,52 @@ | ||
| 25 | 25 | "* **cpd** - Checkins per day. Defaults to 20.\n", |
| 26 | 26 | "\n", |
| 27 | 27 | "* **days** - Number of days to simulate. Defaults to 10000, or roughly\n", |
| 28 | 28 | " 40 working years.\n", |
| 29 | 29 | "\n", |
| 30 | - "* **winSz** - Size of the commit window in percentage of the working day.\n", | |
| 31 | - " Defaults to 0.01% with the default for workSec, which is roughly 3\n", | |
| 32 | - " seconds with the default `workSec` value, a long-ish commit time for Fossil.\n", | |
| 30 | + "* **winSz** - Size of the commit window as a fraction of `workSec`. Defaults\n", | |
| 31 | + " to 0.01%, which is roughly 3 seconds for the default 8-hour work day, a\n", | |
| 32 | + " a long-ish commit time for Fossil.\n", | |
| 33 | 33 | "\n", |
| 34 | 34 | "* **workSec** - Seconds in working day, defaulting to 8 hours. This value\n", |
| 35 | 35 | " only affects the reporting output, not the results of the underlying\n", |
| 36 | 36 | " simulation. It's a scaling parameter to humanize the results.\n", |
| 37 | 37 | " \n", |
| 38 | - "* **sd** - The standard deviation to use for our normally-distributed random\n", | |
| 39 | - " numbers. The default gives \"nice\" distributions, spread over the working\n", | |
| 40 | - " day with a low chance of generating values outside the working day.\n", | |
| 41 | - " \n", | |
| 42 | - " The larger this value gets, the more spread out the checkins, and so the\n", | |
| 43 | - " lower the chance of collisions. You might want to increase it a bit to\n", | |
| 44 | - " simulate early and late workers. (e.g. `workSec / 3`)\n", | |
| 45 | - " \n", | |
| 46 | - " As you decrease this value — e.g. `workSec / 5` — you're simulating a work\n", | |
| 47 | - " environment where people tend to check their work in closer and closer\n", | |
| 48 | - " to mid-day, which increases the chance of collision.\n" | |
| 38 | + "* **spread** - Adjustment factor in computing the standard deviation for our \n", | |
| 39 | + " normally-distributed random numbers. The default gives \"nice\" distributions,\n", | |
| 40 | + " spread over the working day with a low chance of generating values outside\n", | |
| 41 | + " the working day.\n", | |
| 42 | + " \n", | |
| 43 | + " The smaller this value gets (<4), the more spread out the checkins, and\n", | |
| 44 | + " so the lower the chance of collisions. You might want to decrease it a bit\n", | |
| 45 | + " to simulate early and late workers.\n", | |
| 46 | + " \n", | |
| 47 | + " As you increase this value (>4) you're simulating a work environment\n", | |
| 48 | + " where people tend to check their work in closer and closer to mid-day,\n", | |
| 49 | + " which increases the chance of collision." | |
| 49 | 50 | ] |
| 50 | 51 | }, |
| 51 | 52 | { |
| 52 | 53 | "cell_type": "code", |
| 53 | - "execution_count": 8, | |
| 54 | + "execution_count": 2, | |
| 54 | 55 | "metadata": {}, |
| 55 | 56 | "outputs": [], |
| 56 | 57 | "source": [ |
| 57 | 58 | "collisions <- function(\n", |
| 58 | 59 | " cpd = 20,\n", |
| 59 | 60 | " days = 10000,\n", |
| 60 | 61 | " winSz = 0.01 / 100,\n", |
| 61 | 62 | " workSec = 8 * 60 * 60,\n", |
| 62 | - " sd = workSec / 4)\n", | |
| 63 | + " spread = 4)\n", | |
| 63 | 64 | "{\n", |
| 64 | 65 | " cat(\"Running simulation...\\n\")\n", |
| 65 | 66 | "\n", |
| 66 | 67 | " day = 0\n", |
| 67 | 68 | " collisions = 0\n", |
| 68 | 69 | " winSec = workSec * winSz\n", |
| 69 | 70 | " mean = workSec / 2\n", |
| 71 | + " sd = workSec / spread\n", | |
| 70 | 72 | "\n", |
| 71 | 73 | " while (day < days) {\n", |
| 72 | 74 | " # Create the commit time vector as random values in a normal\n", |
| 73 | 75 | " # distribution.\n", |
| 74 | 76 | " times = sort(rnorm(cpd, mean, sd))\n", |
| @@ -89,34 +91,34 @@ | ||
| 89 | 91 | " cat(\"Found\", collisions, \"collisions in\", days, (workSec / 3600),\n", |
| 90 | 92 | " \"hour working days with\", winSec, \"second windows.\\n\")\n", |
| 91 | 93 | "}" |
| 92 | 94 | ] |
| 93 | 95 | }, |
| 96 | + { | |
| 97 | + "cell_type": "markdown", | |
| 98 | + "metadata": {}, | |
| 99 | + "source": [ | |
| 100 | + "*Run the following cell, possibly changing parameters documented above:*" | |
| 101 | + ] | |
| 102 | + }, | |
| 94 | 103 | { |
| 95 | 104 | "cell_type": "code", |
| 96 | - "execution_count": 10, | |
| 105 | + "execution_count": 3, | |
| 97 | 106 | "metadata": {}, |
| 98 | 107 | "outputs": [ |
| 99 | 108 | { |
| 100 | 109 | "name": "stdout", |
| 101 | 110 | "output_type": "stream", |
| 102 | 111 | "text": [ |
| 103 | 112 | "Running simulation...\n", |
| 104 | - "Found 423 collisions in 10000 8 hour working days with 2.88 second windows.\n" | |
| 113 | + "Found 422 collisions in 10000 8 hour working days with 2.88 second windows.\n" | |
| 105 | 114 | ] |
| 106 | 115 | } |
| 107 | 116 | ], |
| 108 | 117 | "source": [ |
| 109 | 118 | "collisions()" |
| 110 | 119 | ] |
| 111 | - }, | |
| 112 | - { | |
| 113 | - "cell_type": "code", | |
| 114 | - "execution_count": null, | |
| 115 | - "metadata": {}, | |
| 116 | - "outputs": [], | |
| 117 | - "source": [] | |
| 118 | 120 | } |
| 119 | 121 | ], |
| 120 | 122 | "metadata": { |
| 121 | 123 | "kernelspec": { |
| 122 | 124 | "display_name": "R", |
| 123 | 125 |
| --- www/collisions.ipynb | |
| +++ www/collisions.ipynb | |
| @@ -2,11 +2,11 @@ | |
| 2 | "cells": [ |
| 3 | { |
| 4 | "cell_type": "markdown", |
| 5 | "metadata": {}, |
| 6 | "source": [ |
| 7 | "Pull in the packages we need" |
| 8 | ] |
| 9 | }, |
| 10 | { |
| 11 | "cell_type": "code", |
| 12 | "execution_count": 1, |
| @@ -25,50 +25,52 @@ | |
| 25 | "* **cpd** - Checkins per day. Defaults to 20.\n", |
| 26 | "\n", |
| 27 | "* **days** - Number of days to simulate. Defaults to 10000, or roughly\n", |
| 28 | " 40 working years.\n", |
| 29 | "\n", |
| 30 | "* **winSz** - Size of the commit window in percentage of the working day.\n", |
| 31 | " Defaults to 0.01% with the default for workSec, which is roughly 3\n", |
| 32 | " seconds with the default `workSec` value, a long-ish commit time for Fossil.\n", |
| 33 | "\n", |
| 34 | "* **workSec** - Seconds in working day, defaulting to 8 hours. This value\n", |
| 35 | " only affects the reporting output, not the results of the underlying\n", |
| 36 | " simulation. It's a scaling parameter to humanize the results.\n", |
| 37 | " \n", |
| 38 | "* **sd** - The standard deviation to use for our normally-distributed random\n", |
| 39 | " numbers. The default gives \"nice\" distributions, spread over the working\n", |
| 40 | " day with a low chance of generating values outside the working day.\n", |
| 41 | " \n", |
| 42 | " The larger this value gets, the more spread out the checkins, and so the\n", |
| 43 | " lower the chance of collisions. You might want to increase it a bit to\n", |
| 44 | " simulate early and late workers. (e.g. `workSec / 3`)\n", |
| 45 | " \n", |
| 46 | " As you decrease this value — e.g. `workSec / 5` — you're simulating a work\n", |
| 47 | " environment where people tend to check their work in closer and closer\n", |
| 48 | " to mid-day, which increases the chance of collision.\n" |
| 49 | ] |
| 50 | }, |
| 51 | { |
| 52 | "cell_type": "code", |
| 53 | "execution_count": 8, |
| 54 | "metadata": {}, |
| 55 | "outputs": [], |
| 56 | "source": [ |
| 57 | "collisions <- function(\n", |
| 58 | " cpd = 20,\n", |
| 59 | " days = 10000,\n", |
| 60 | " winSz = 0.01 / 100,\n", |
| 61 | " workSec = 8 * 60 * 60,\n", |
| 62 | " sd = workSec / 4)\n", |
| 63 | "{\n", |
| 64 | " cat(\"Running simulation...\\n\")\n", |
| 65 | "\n", |
| 66 | " day = 0\n", |
| 67 | " collisions = 0\n", |
| 68 | " winSec = workSec * winSz\n", |
| 69 | " mean = workSec / 2\n", |
| 70 | "\n", |
| 71 | " while (day < days) {\n", |
| 72 | " # Create the commit time vector as random values in a normal\n", |
| 73 | " # distribution.\n", |
| 74 | " times = sort(rnorm(cpd, mean, sd))\n", |
| @@ -89,34 +91,34 @@ | |
| 89 | " cat(\"Found\", collisions, \"collisions in\", days, (workSec / 3600),\n", |
| 90 | " \"hour working days with\", winSec, \"second windows.\\n\")\n", |
| 91 | "}" |
| 92 | ] |
| 93 | }, |
| 94 | { |
| 95 | "cell_type": "code", |
| 96 | "execution_count": 10, |
| 97 | "metadata": {}, |
| 98 | "outputs": [ |
| 99 | { |
| 100 | "name": "stdout", |
| 101 | "output_type": "stream", |
| 102 | "text": [ |
| 103 | "Running simulation...\n", |
| 104 | "Found 423 collisions in 10000 8 hour working days with 2.88 second windows.\n" |
| 105 | ] |
| 106 | } |
| 107 | ], |
| 108 | "source": [ |
| 109 | "collisions()" |
| 110 | ] |
| 111 | }, |
| 112 | { |
| 113 | "cell_type": "code", |
| 114 | "execution_count": null, |
| 115 | "metadata": {}, |
| 116 | "outputs": [], |
| 117 | "source": [] |
| 118 | } |
| 119 | ], |
| 120 | "metadata": { |
| 121 | "kernelspec": { |
| 122 | "display_name": "R", |
| 123 |
| --- www/collisions.ipynb | |
| +++ www/collisions.ipynb | |
| @@ -2,11 +2,11 @@ | |
| 2 | "cells": [ |
| 3 | { |
| 4 | "cell_type": "markdown", |
| 5 | "metadata": {}, |
| 6 | "source": [ |
| 7 | "*Pull in the packages we need:*" |
| 8 | ] |
| 9 | }, |
| 10 | { |
| 11 | "cell_type": "code", |
| 12 | "execution_count": 1, |
| @@ -25,50 +25,52 @@ | |
| 25 | "* **cpd** - Checkins per day. Defaults to 20.\n", |
| 26 | "\n", |
| 27 | "* **days** - Number of days to simulate. Defaults to 10000, or roughly\n", |
| 28 | " 40 working years.\n", |
| 29 | "\n", |
| 30 | "* **winSz** - Size of the commit window as a fraction of `workSec`. Defaults\n", |
| 31 | " to 0.01%, which is roughly 3 seconds for the default 8-hour work day, a\n", |
| 32 | " a long-ish commit time for Fossil.\n", |
| 33 | "\n", |
| 34 | "* **workSec** - Seconds in working day, defaulting to 8 hours. This value\n", |
| 35 | " only affects the reporting output, not the results of the underlying\n", |
| 36 | " simulation. It's a scaling parameter to humanize the results.\n", |
| 37 | " \n", |
| 38 | "* **spread** - Adjustment factor in computing the standard deviation for our \n", |
| 39 | " normally-distributed random numbers. The default gives \"nice\" distributions,\n", |
| 40 | " spread over the working day with a low chance of generating values outside\n", |
| 41 | " the working day.\n", |
| 42 | " \n", |
| 43 | " The smaller this value gets (<4), the more spread out the checkins, and\n", |
| 44 | " so the lower the chance of collisions. You might want to decrease it a bit\n", |
| 45 | " to simulate early and late workers.\n", |
| 46 | " \n", |
| 47 | " As you increase this value (>4) you're simulating a work environment\n", |
| 48 | " where people tend to check their work in closer and closer to mid-day,\n", |
| 49 | " which increases the chance of collision." |
| 50 | ] |
| 51 | }, |
| 52 | { |
| 53 | "cell_type": "code", |
| 54 | "execution_count": 2, |
| 55 | "metadata": {}, |
| 56 | "outputs": [], |
| 57 | "source": [ |
| 58 | "collisions <- function(\n", |
| 59 | " cpd = 20,\n", |
| 60 | " days = 10000,\n", |
| 61 | " winSz = 0.01 / 100,\n", |
| 62 | " workSec = 8 * 60 * 60,\n", |
| 63 | " spread = 4)\n", |
| 64 | "{\n", |
| 65 | " cat(\"Running simulation...\\n\")\n", |
| 66 | "\n", |
| 67 | " day = 0\n", |
| 68 | " collisions = 0\n", |
| 69 | " winSec = workSec * winSz\n", |
| 70 | " mean = workSec / 2\n", |
| 71 | " sd = workSec / spread\n", |
| 72 | "\n", |
| 73 | " while (day < days) {\n", |
| 74 | " # Create the commit time vector as random values in a normal\n", |
| 75 | " # distribution.\n", |
| 76 | " times = sort(rnorm(cpd, mean, sd))\n", |
| @@ -89,34 +91,34 @@ | |
| 91 | " cat(\"Found\", collisions, \"collisions in\", days, (workSec / 3600),\n", |
| 92 | " \"hour working days with\", winSec, \"second windows.\\n\")\n", |
| 93 | "}" |
| 94 | ] |
| 95 | }, |
| 96 | { |
| 97 | "cell_type": "markdown", |
| 98 | "metadata": {}, |
| 99 | "source": [ |
| 100 | "*Run the following cell, possibly changing parameters documented above:*" |
| 101 | ] |
| 102 | }, |
| 103 | { |
| 104 | "cell_type": "code", |
| 105 | "execution_count": 3, |
| 106 | "metadata": {}, |
| 107 | "outputs": [ |
| 108 | { |
| 109 | "name": "stdout", |
| 110 | "output_type": "stream", |
| 111 | "text": [ |
| 112 | "Running simulation...\n", |
| 113 | "Found 422 collisions in 10000 8 hour working days with 2.88 second windows.\n" |
| 114 | ] |
| 115 | } |
| 116 | ], |
| 117 | "source": [ |
| 118 | "collisions()" |
| 119 | ] |
| 120 | } |
| 121 | ], |
| 122 | "metadata": { |
| 123 | "kernelspec": { |
| 124 | "display_name": "R", |
| 125 |