{"id":23792483,"url":"https://github.com/se2p/scratch-anomalies","last_synced_at":"2025-09-05T23:45:34.945Z","repository":{"id":80478194,"uuid":"304926661","full_name":"se2p/scratch-anomalies","owner":"se2p","description":"Anomaly Detection in Scratch","archived":false,"fork":false,"pushed_at":"2021-05-06T06:39:53.000Z","size":18087,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-01T18:36:34.801Z","etag":null,"topics":["anomaly-detection","block-based-programming","program-analysis","scratch","teaching"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/se2p.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-10-17T16:58:26.000Z","updated_at":"2022-10-27T15:06:31.000Z","dependencies_parsed_at":"2023-02-27T13:01:24.734Z","dependency_job_id":null,"html_url":"https://github.com/se2p/scratch-anomalies","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/se2p%2Fscratch-anomalies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/se2p%2Fscratch-anomalies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/se2p%2Fscratch-anomalies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/se2p%2Fscratch-anomalies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/se2p","download_url":"https://codeload.github.com/se2p/scratch-anomalies/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240021409,"owners_count":19735315,"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":["anomaly-detection","block-based-programming","program-analysis","scratch","teaching"],"created_at":"2025-01-01T18:35:17.940Z","updated_at":"2025-02-21T13:27:06.728Z","avatar_url":"https://github.com/se2p.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Anomaly Detection in Scratch\n\nAnomaly detection is a quick way to find erroneous scripts, alternative solutions or distinguished work in a set of Scratch programs which implement the same or similar tasks. To the best of our knowledge, this repository contains the first collection of tools for anomaly detection in Scratch: \n- An extension of [LitterBox](https://github.com/se2p/LitterBox/) that is used for the generation of script models - for the actor specific variant check out the branch ```script-model-generator-actor-specific```\n- An adapted version of [JADET](https://www.st.cs.uni-saarland.de/models/jadet/) used for pattern and violation mining\n- An adapted version of [OUMExtractor](https://www.st.cs.uni-saarland.de/models/jadet/), a dependency for LitterBox and JADET\n\n# Publications\n## Conference Proceedings\n- Nina Körber, \"Anomaly Detection in Scratch Assignments\" In International Conference on Software Engineering: Companion Proceedings (ICSE-Companion), 2021. [Download pre-print version](https://arxiv.org/abs/2103.08261).\n- Nina Körber, Katharina Geldreich, Andreas Stahlbauer, and Gordon Fraser, “Finding Anomalies in Scratch Assignments” In International Conference on Software Engineering: Software Engineering Education and Training Track (ICSE-SEET), 2021. [Download pre-print version](https://arxiv.org/abs/2102.07446)\n\n## Theses\n- Nina Körber. “Anomaly Detection in Scratch: Patterns and Their Violations”. Bachelor's Thesis. University of Passau, 2020. [Download](https://drive.google.com/file/d/1AhaqG3FeC4z1fOPT5DjsSiOlDTzveo1j/view)\n\n# How to Mine Patterns and Anomalies\n## Script Model Generation\nLitterBox creates script models which are the input for JADET for both violation and pattern mining.\nUse the [LitterBox jar](https://github.com/se2p/scratch-anomalies/blob/master/litterbox/Litterbox-1.4-SNAPSHOT.jar) to generate script models:\n```\njava -jar Litterbox-1.4-SNAPSHOT.jar --models --path \u003cpath to projects directory\u003e --output \u003cpath to models directory\u003e\n```\nNote that LitterBox deletes all files in the output directory before every run to keep models of different runs separated.\n\n## Violations and Patterns\nLinux and Mac: For all JADET-related steps use this [bash script](https://github.com/se2p/scratch-anomalies/blob/master/jadet/jadet).\n### Violation Mining\n\nTo mine violations on Linux and Mac use \n```\n./jadet -output-violations-xml -models-dir \u003cpath to models directory\u003e 20 2 10000 0.9 \u003cpath to xml file\u003e\n```\n\u003c!--\nOn Windows use \n```\n\n``` \n--\u003e\nThe values 20 and 2 are our suggested default values for the minimum support \n(#scripts supporting a pattern) and minimum size (#temporal properties) of a pattern.\nThe value 10,000 defines the maximum deviation level (#missing temporal properties) \nand we strongly suggest to keep it at its default value. The last value sets the\nthreshold for the confidence of violations.  \nIf you want to have more anomalies reported, lower the minimum support or minimum\nconfidence values.\n\n### Graphical User Interface\nJADET has a GUI we adapted to work with Scratch scripts.  \nTo view the graphical representations of the violations you need to have [graphviz](https://graphviz.org/) installed.  \nGUI Usage on Linux and Mac:\n```\n ./jadet -edit-violations-xml \u003cpath to xml file\u003e\n```\n\u003c!--\nOn Windows (we do not support the graphical representation of the violations on Windows yet):\n```\n\n``` \n--\u003e\n The GUI displays all violations found and offers means to classify violations \n and compare the script a violation hints at with the scripts that support the \n pattern. For all these scripts, we display scratchblocks output that can \n conveniently be copy+pasted to [scratchblocks](https://scratchblocks.github.io)\n to have a look at the scripts. \n\n### Pattern Mining\nJADET can be used to create a human-readable list of patterns of code.  \nLinux and Mac:\n```\n ./jadet -output-patterns -models-dir \u003cpath to models directory\u003e 20 1 \u003cpath to patterns file\u003e\n```\n\u003c!--\nWindows:  \n```\n\n```\n--\u003e\nThe values 20 and 1 are our suggested default values for the minimum support \n(#scripts supporting a pattern) and minimum size (#temporal properties) of a pattern.\n\nTo generate dotfile output for these patterns on Linux and Mac use\n```\n./jadet -visualize-all \u003cpath to directory for dotfiles\u003e \u003cpath to patterns file\u003e \n```\n\u003c!--\nOn Windows use \n```\n\n```\n--\u003e\nTo render these patterns use\n```\nfor i in {1..\u003cnum of patterns generated\u003e}; do dot -Tpng -Gdpi=300 pattern$i.dot \u003e ../\u003cdirectory for pngs\u003e/pattern$i.png; done\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fse2p%2Fscratch-anomalies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fse2p%2Fscratch-anomalies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fse2p%2Fscratch-anomalies/lists"}