{"id":16272018,"url":"https://github.com/sshh12/sheet-log","last_synced_at":"2025-04-08T15:45:03.816Z","repository":{"id":70737764,"uuid":"372053301","full_name":"sshh12/sheet-log","owner":"sshh12","description":"Push Python metrics and plots directly into Google Sheets.","archived":false,"fork":false,"pushed_at":"2021-05-31T18:50:58.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-14T12:17:38.219Z","etag":null,"topics":["google-sheets","logging","machine-learning-experimentation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sshh12.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-29T19:18:25.000Z","updated_at":"2021-05-31T18:53:01.000Z","dependencies_parsed_at":"2023-02-21T20:31:43.696Z","dependency_job_id":null,"html_url":"https://github.com/sshh12/sheet-log","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshh12%2Fsheet-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshh12%2Fsheet-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshh12%2Fsheet-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshh12%2Fsheet-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshh12","download_url":"https://codeload.github.com/sshh12/sheet-log/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247874023,"owners_count":21010572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-sheets","logging","machine-learning-experimentation"],"created_at":"2024-10-10T18:15:49.947Z","updated_at":"2025-04-08T15:45:03.781Z","avatar_url":"https://github.com/sshh12.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sheet-log\n\n## Install\n\n1. `pip install git+https://github.com/sshh12/sheet-log`\n2. Create a script on [script.google.com](https://script.google.com/), copy-paste the contents of `Code.gs`, then deploy (`Execute as: Me`, `Who has access: Anyone`) as web-app.\n3. Create a [google sheet](https://sheet.new) that includes a tab named `sheetlog`. This is to ensure the web-app only modifies spreadsheets that are used by this app.\n\n## Usage\n\n### Scikit-learn GridCV Table\n\n```python\nfrom sklearn.datasets import make_classification\nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.svm import SVC\n\nfrom sheetlog import SheetLog\n\nsl = SheetLog(\n    app_url=\"https://script.google.com/macros/s/.../exec\",\n    spreadsheet_id=\"5F31_GE54Vi_....\",\n)\n\nparam_grid = {\"kernel\": (\"linear\", \"rbf\"), \"C\": [1, 10, 100]}\nbase_estimator = SVC(gamma=\"scale\")\nX, y = make_classification(n_samples=1000)\ngcv = GridSearchCV(base_estimator, param_grid, cv=5)\ngcv.fit(X, y)\n\nfor params, mean_test_score, rank_test_score in zip(\n    gcv.cv_results_[\"params\"], gcv.cv_results_[\"mean_test_score\"], gcv.cv_results_[\"rank_test_score\"]\n):\n    sl.add(dict(**params, test_score=mean_test_score, rank_score=rank_test_score))\n```\n\n![scikit learn example](https://user-images.githubusercontent.com/6625384/120229535-f6c15f80-c212-11eb-8ac8-53aa570a1187.png)\n\n### Scikit-learn TSNE Tabs\n\nCode example adapted from _[t-SNE: The effect of various perplexity values on the shape](https://scikit-learn.org/stable/auto_examples/manifold/plot_t_sne_perplexity.html)_.\n\n```python\nfrom sklearn import manifold, datasets\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport time\n\nfrom sheetlog import SheetLog\n\nsl = SheetLog(\n    app_url=\"https://script.google.com/macros/s/.../exec\",\n    spreadsheet_id=\"5F31_GE54Vi_....\",\n)\n\nn_samples = 300\nn_components = 2\nperplexities = [5, 30, 50, 100]\n\nX, y = datasets.make_circles(n_samples=n_samples, factor=0.5, noise=0.05)\n\nred = y == 0\ngreen = y == 1\n\nfor i, perplexity in enumerate(perplexities):\n    t0 = time.time()\n    tsne = manifold.TSNE(n_components=n_components, init=\"random\", random_state=0, perplexity=perplexity)\n    Y = tsne.fit_transform(X)\n    t1 = time.time()\n    name = \"circles, perplexity=%d in %.2g sec\" % (perplexity, t1 - t0)\n    plt.title(\"Perplexity=%d\" % perplexity)\n    plt.scatter(Y[red, 0], Y[red, 1], c=\"r\")\n    plt.scatter(Y[green, 0], Y[green, 1], c=\"g\")\n    plt.axis(\"tight\")\n    sl.add(dict(perplexity=perplexity, time=t1 - t0, plot=sl.get_current_plot()), sheet=name)\n\nX, color = datasets.make_s_curve(n_samples, random_state=0)\n\nfor i, perplexity in enumerate(perplexities):\n    t0 = time.time()\n    tsne = manifold.TSNE(n_components=n_components, init=\"random\", random_state=0, perplexity=perplexity)\n    Y = tsne.fit_transform(X)\n    t1 = time.time()\n    name = \"S-curve, perplexity=%d in %.2g sec\" % (perplexity, t1 - t0)\n    plt.title(\"Perplexity=%d\" % perplexity)\n    plt.scatter(Y[:, 0], Y[:, 1], c=color)\n    plt.axis(\"tight\")\n    sl.add(dict(perplexity=perplexity, time=t1 - t0, plot=sl.get_current_plot()), sheet=name)\n\nx = np.linspace(0, 1, int(np.sqrt(n_samples)))\nxx, yy = np.meshgrid(x, x)\nX = np.hstack(\n    [\n        xx.ravel().reshape(-1, 1),\n        yy.ravel().reshape(-1, 1),\n    ]\n)\ncolor = xx.ravel()\n\nfor i, perplexity in enumerate(perplexities):\n    t0 = time.time()\n    tsne = manifold.TSNE(n_components=n_components, init=\"random\", random_state=0, perplexity=perplexity)\n    Y = tsne.fit_transform(X)\n    t1 = time.time()\n    name = \"uniform grid, perplexity=%d in %.2g sec\" % (perplexity, t1 - t0)\n    plt.title(\"Perplexity=%d\" % perplexity)\n    plt.scatter(Y[:, 0], Y[:, 1], c=color)\n    plt.axis(\"tight\")\n    sl.add(dict(perplexity=perplexity, time=t1 - t0, plot=sl.get_current_plot()), sheet=name)\n```\n\n![scikit learn example 2](https://user-images.githubusercontent.com/6625384/120231093-42c1d380-c216-11eb-925b-ebf708313179.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshh12%2Fsheet-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshh12%2Fsheet-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshh12%2Fsheet-log/lists"}