Repository Analysis

Unity-Technologies/ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.

7.8 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of Unity-Technologies/ml-agents, a C# project with 19,598 GitHub stars. SynthScan v2.0 examined 110,192 lines of code across 789 source files, recording 664 pattern matches distributed across 19 syntactic categories. The overall adjusted score of 7.8 places this repository in the Low AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

7.8
Adjusted Score
7.8
Raw Score
100%
Time Factor
2026-07-29
Last Push
19.6K
Stars
C#
Language
110.2K
Lines of Code
789
Files
664
Pattern Hits
2026-08-02
Scan Date
0.05
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 3HIGH 33MEDIUM 19LOW 609

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 664 distinct pattern matches across 19 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers240 hits · 241 pts
SeverityFileLineSnippetContext
LOWTools/ci/onboard.py74def update_template_variables(packages):CODE
LOWml-agents/tests/yamato/yamato_utils.py9def get_unity_executable_path():CODE
LOWml-agents/tests/yamato/yamato_utils.py209def override_legacy_config_file(python_version, src_path, dest_path, **kwargs):CODE
LOWml-agents/mlagents/plugins/trainer_type.py17def get_default_trainer_types() -> Tuple[Dict[str, Any], Dict[str, Any]]:CODE
LOWml-agents/mlagents/plugins/stats_writer.py13def get_default_stats_writers(run_options: RunOptions) -> List[StatsWriter]:CODE
LOWml-agents/mlagents/plugins/stats_writer.py32def register_stats_writer_plugins(run_options: RunOptions) -> List[StatsWriter]:CODE
LOWml-agents/mlagents/trainers/upgrade_config.py103def convert_samplers_and_curriculum(CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py355 def _assert_worker_can_restart(self, worker_id: int, exception: Exception) -> None:CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py376 def _worker_has_restart_quota(self, worker_id: int) -> bool:CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py392 def _drop_old_restart_timestamps(self, worker_id: int) -> None:CODE
LOWml-agents/mlagents/trainers/directory_utils.py8def validate_existing_directories(CODE
LOWml-agents/mlagents/trainers/trainer_controller.py115 def _create_trainer_and_manager(CODE
LOWml-agents/mlagents/trainers/trainer_controller.py161 def _create_trainers_and_managers(CODE
LOWml-agents/mlagents/trainers/agent_processor.py159 def _add_group_status_and_obs(CODE
LOWml-agents/mlagents/trainers/agent_processor.py198 def _clear_group_status_and_obs(self, global_id: GlobalAgentId) -> None:CODE
LOWml-agents/mlagents/trainers/stats.py251 def _maybe_create_summary_writer(self, category: str) -> None:CODE
LOWml-agents/mlagents/trainers/learn.py175def create_environment_factory(CODE
LOWml-agents/mlagents/trainers/settings.py48def check_hyperparam_schedules(val: Dict, trainer_type: str) -> Dict:CODE
LOWml-agents/mlagents/trainers/settings.py622 def _set_default_hyperparameters(self):CODE
LOWml-agents/mlagents/trainers/settings.py626 def _set_default_checkpoint_interval(self):CODE
LOWml-agents/mlagents/trainers/settings.py649 def _check_batch_size_seq_length(self, attribute, value):CODE
LOW…s/mlagents/trainers/training_analytics_side_channel.py136 def _sanitize_trainer_settings(cls, config: TrainerSettings) -> Dict[str, Any]:CODE
LOW…s/mlagents/trainers/training_analytics_side_channel.py178 def _behavior_uses_curriculum(self, behavior_name: str) -> bool:CODE
LOW…nts/mlagents/trainers/environment_parameter_manager.py62 def get_minimum_reward_buffer_size(self, behavior_name: str) -> int:CODE
LOW…nts/mlagents/trainers/environment_parameter_manager.py94 def get_current_lesson_number(self) -> Dict[str, int]:CODE
LOWml-agents/mlagents/trainers/sac/optimizer_torch.py40 def _reward_signal_steps_per_update_default(self):CODE
LOW…-agents/mlagents/trainers/optimizer/torch_optimizer.py141 def get_trajectory_value_estimates(CODE
LOWml-agents/mlagents/trainers/tests/test_rl_trainer.py202def test_update_buffer_append():CODE
LOWml-agents/mlagents/trainers/tests/test_rl_trainer.py236 def test_warning_group_reward(self):CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py22def test_stat_reporter_add_summary_write():CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py68def test_stat_reporter_property():CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py114def test_agent_manager_stats_report(aggregation_type):CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py134def test_tensorboard_writer_clear(tmp_path):CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py157def test_tensorboard_writer_hidden_keys(mock_summary):CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py181def test_gauge_stat_writer_sanitize():CODE
LOWml-agents/mlagents/trainers/tests/test_stats.py230 def test_selfplay_console_writer(self):CODE
LOWml-agents/mlagents/trainers/tests/test_demo_loader.py119def test_unsupported_version_raises_error(mock_get_demo_files):CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py35def generate_list_agent_proto(CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py88def generate_compressed_proto_obs(CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py104def generate_compressed_proto_obs_with_mapping(CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py123def generate_uncompressed_proto_obs(in_array: np.ndarray) -> ObservationProto:CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py205def proto_from_steps_and_action(CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py245def test_process_pixels_multi_png():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py279def test_process_visual_observation():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py301def test_process_visual_observation_grayscale():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py325def test_process_visual_observation_padded_channels():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py344def test_process_visual_observation_bad_shape():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py358def test_batched_step_result_from_proto():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py388def test_mismatch_observations_raise_in_step_result_from_proto():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py402def test_action_masking_discrete():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py453def test_action_masking_continuous():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py465def test_agent_behavior_spec_from_proto():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py485def test_batched_step_result_from_proto_raises_on_infinite():CODE
LOWml-agents/mlagents/trainers/tests/test_rpc_utils.py496def test_batched_step_result_from_proto_raises_on_nan():CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py43def trainer_controller_with_start_learning_mocks(basic_trainer_controller):CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py73def test_start_learning_trains_forever_if_no_train_model(CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py90def test_start_learning_trains_until_max_steps_then_saves(CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py108def trainer_controller_with_take_step_mocks(basic_trainer_controller):CODE
LOW…nts/mlagents/trainers/tests/test_trainer_controller.py122def test_advance_adds_experiences_to_trainer_and_trains(CODE
LOW…trainers/tests/test_training_analytics_side_channel.py36def test_sanitize_run_options():STRING
180 more matches not shown…
Over-Commented Block208 hits · 198 pts
SeverityFileLineSnippetContext
LOW.yamato/sonar-python-package.yml1#csharp:COMMENT
LOW.yamato/com.unity.ml-agents-performance.yml1#disabling mac perf tests until utr issue is resolved.COMMENT
LOW.yamato/com.unity.ml-agents-performance.yml21# cancel_old_ci: trueCOMMENT
LOW.yamato/wrench/player-test.yml1#######################################################COMMENT
LOW.yamato/wrench/player-build.yml1#######################################################COMMENT
LOW…ents.tests/Tests/Runtime/Input/TestPushBlockActions.cs1#if MLA_INPUT_TESTSCOMMENT
LOW…ents.tests/Tests/Runtime/Sensor/GridSensorTestUtils.cs21 }COMMENT
LOW…ents.tests/Tests/Runtime/Sensor/GridSensorTestUtils.cs41 /// Which will make the total array will be the flattened arrayCOMMENT
LOW…Agents/Examples/PushBlock/Scripts/PushBlockSettings.cs1using UnityEngine;COMMENT
LOW…ssets/ML-Agents/Examples/Match3/Scripts/Match3Agent.cs1using System;COMMENT
LOW…ssets/ML-Agents/Examples/Match3/Scripts/Match3Agent.cs21 /// | |COMMENT
LOW…ssets/ML-Agents/Examples/Match3/Scripts/Match3Agent.cs41 FindMatches = 0,COMMENT
LOW…ets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs1using System.Collections.Generic;COMMENT
LOW…ets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs201 }COMMENT
LOW…ts/Examples/SharedAssets/Scripts/CollisionCallbacks.cs1using UnityEngine;COMMENT
LOW…ts/Examples/SharedAssets/Scripts/CollisionCallbacks.cs21 [Header("Collider Tag To Detect")]COMMENT
LOW…ts/Examples/SharedAssets/Scripts/CollisionCallbacks.cs61 // if (respawnIfTouched)COMMENT
LOW…ts/Examples/SharedAssets/Scripts/CollisionCallbacks.cs81 // /// </summary>COMMENT
LOW…Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs281 return null;COMMENT
LOW…Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs301COMMENT
LOW…Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs321 // assetData.value = descStream.ToArray();COMMENT
LOW…Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs341 //COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs1//------------------------------------------------------------------------------COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs21/// <remarks>COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs41///COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs61/// {COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs361COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs381 public void Disable() { Get().Disable(); }COMMENT
LOW…xamples/PushBlockWithInput/Scripts/PushBlockActions.cs481 /// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />COMMENT
LOW…shBlockWithInput/Scripts/PushBlockWithInputSettings.cs21 /// The spawn area margin multiplier.COMMENT
LOW…ithInput/Scripts/PushBlockWithInputPlayerController.cs1using Unity.MLAgents.Input;COMMENT
LOWml-agents-envs/mlagents_envs/environment.py61 # Revision history:COMMENT
LOWml-agents-envs/tests/simple_test_envs.py221 # new_vector_obs = self._make_obs(self.goal[name])COMMENT
LOWcom.unity.ml-agents/Runtime/InplaceArray.cs201 }COMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs21 const double k_TicksToSeconds = 1e-7; // 100 ns per tickCOMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs41 /// Number of total ticks elapsed for this node.COMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs301 /// The largest value that has been seen for the gauge since it was created.COMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs341 weightedAverage = (k_SmoothingFactor * newValue) + ((1f - k_SmoothingFactor) * weightedAverage);COMMENT
LOWcom.unity.ml-agents/Runtime/Timer.cs361 /// doSomeMoreWork();COMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs41 elseCOMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs61 /// fall back to inference or heuristic decisions. (You can also set agents to always useCOMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs81 /// </item>COMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs121 /// </summary>COMMENT
LOWcom.unity.ml-agents/Runtime/Academy.cs201 // that all the agents perform their steps in a consistent order (i.e. noCOMMENT
LOWcom.unity.ml-agents/Runtime/SimpleMultiAgentGroup.cs61 {COMMENT
LOWcom.unity.ml-agents/Runtime/SimpleMultiAgentGroup.cs81 public void AddGroupReward(float reward)COMMENT
LOWcom.unity.ml-agents/Runtime/SimpleMultiAgentGroup.cs101 /// Group rewards are treated differently than individual agent rewards during training, soCOMMENT
LOWcom.unity.ml-agents/Runtime/EnvironmentParameters.cs1using System;COMMENT
LOWcom.unity.ml-agents/Runtime/EnvironmentParameters.cs21COMMENT
LOWcom.unity.ml-agents/Runtime/EnvironmentParameters.cs41 return m_Channel.GetWithDefault(key, defaultValue);COMMENT
LOWcom.unity.ml-agents/Runtime/SensorHelper.cs1using Unity.InferenceEngine;COMMENT
LOWcom.unity.ml-agents/Runtime/StatsRecorder.cs1using Unity.MLAgents.SideChannels;COMMENT
LOWcom.unity.ml-agents/Runtime/StatsRecorder.cs21COMMENT
LOWcom.unity.ml-agents/Runtime/IMultiAgentGroup.cs1namespace Unity.MLAgentsCOMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs21 /// <summary>COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs41COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs101 { }COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs121 ///COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs141 /// making is used.COMMENT
LOWcom.unity.ml-agents/Runtime/Agent.cs161 /// environment -- by implementing the <see cref="OnEpisodeBegin"/> function. An agent alsoCOMMENT
148 more matches not shown…
Cross-File Repetition32 hits · 160 pts
SeverityFileLineSnippetContext
HIGHml-agents/mlagents/trainers/sac/trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGH…iner-plugin/mlagents_trainer_plugin/dqn/dqn_trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGHml-agents/mlagents/trainers/ppo/trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGH…-agents/mlagents/trainers/trainer/on_policy_trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGH…agents/mlagents/trainers/trainer/off_policy_trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGH…iner-plugin/mlagents_trainer_plugin/a2c/a2c_trainer.py0responsible for collecting experiences and training a2c model. :param behavior_name: the name of the behavior associatedSTRING
HIGHml-agents/mlagents/trainers/sac/trainer.py0creates a policy with a pytorch backend and poca hyperparameters :param parsed_behavior_id: :param behavior_spec: specifSTRING
HIGHml-agents/mlagents/trainers/ppo/trainer.py0creates a policy with a pytorch backend and poca hyperparameters :param parsed_behavior_id: :param behavior_spec: specifSTRING
HIGH…iner-plugin/mlagents_trainer_plugin/a2c/a2c_trainer.py0creates a policy with a pytorch backend and poca hyperparameters :param parsed_behavior_id: :param behavior_spec: specifSTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0creates a policy with a pytorch backend and poca hyperparameters :param parsed_behavior_id: :param behavior_spec: specifSTRING
HIGHml-agents/mlagents/trainers/sac/trainer.py0gets policy from trainer associated with name_behavior_id :param name_behavior_id: full identifier of policySTRING
HIGHml-agents/mlagents/trainers/ppo/trainer.py0gets policy from trainer associated with name_behavior_id :param name_behavior_id: full identifier of policySTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0gets policy from trainer associated with name_behavior_id :param name_behavior_id: full identifier of policySTRING
HIGHml-agents/mlagents/trainers/ppo/optimizer_torch.py0performs update on model. :param batch: batch of experiences. :param num_sequences: number of sequences to process. :retSTRING
HIGHml-agents/mlagents/trainers/poca/optimizer_torch.py0performs update on model. :param batch: batch of experiences. :param num_sequences: number of sequences to process. :retSTRING
HIGH…er-plugin/mlagents_trainer_plugin/dqn/dqn_optimizer.py0performs update on model. :param batch: batch of experiences. :param num_sequences: number of sequences to process. :retSTRING
HIGH…er-plugin/mlagents_trainer_plugin/a2c/a2c_optimizer.py0performs update on model. :param batch: batch of experiences. :param num_sequences: number of sequences to process. :retSTRING
HIGHml-agents/mlagents/trainers/ppo/trainer.py0takes a trajectory and processes it, putting it into the update buffer. processing involves calculating value and advantSTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0takes a trajectory and processes it, putting it into the update buffer. processing involves calculating value and advantSTRING
HIGH…iner-plugin/mlagents_trainer_plugin/a2c/a2c_trainer.py0takes a trajectory and processes it, putting it into the update buffer. processing involves calculating value and advantSTRING
HIGHml-agents/mlagents/trainers/poca/trainer.py0returns whether or not the trainer has enough elements to run update model :return: a boolean corresponding to wether orSTRING
HIGH…-agents/mlagents/trainers/trainer/on_policy_trainer.py0returns whether or not the trainer has enough elements to run update model :return: a boolean corresponding to wether orSTRING
HIGH…agents/mlagents/trainers/trainer/off_policy_trainer.py0returns whether or not the trainer has enough elements to run update model :return: a boolean corresponding to wether orSTRING
HIGHml-agents/mlagents/trainers/trainer/rl_trainer.py0returns whether or not the trainer has enough elements to run update model :return: a boolean corresponding to wether orSTRING
HIGHml-agents-envs/mlagents_envs/rpc_communicator.py0sends a shutdown signal to the unity environment, and closes the socket connection.STRING
HIGHml-agents-envs/mlagents_envs/mock_communicator.py0sends a shutdown signal to the unity environment, and closes the socket connection.STRING
HIGHml-agents-envs/mlagents_envs/communicator.py0sends a shutdown signal to the unity environment, and closes the socket connection.STRING
HIGHml-agents-envs/mlagents_envs/environment.py0sends a shutdown signal to the unity environment, and closes the socket connection.STRING
HIGH…s-envs/mlagents_envs/side_channel/raw_bytes_channel.py0is called by the environment to the side channel. can be called multiple times per step if multiple messages are meant fSTRING
HIGH…mlagents_envs/side_channel/float_properties_channel.py0is called by the environment to the side channel. can be called multiple times per step if multiple messages are meant fSTRING
HIGH…agents-envs/mlagents_envs/side_channel/side_channel.py0is called by the environment to the side channel. can be called multiple times per step if multiple messages are meant fSTRING
Deep Nesting39 hits · 39 pts
SeverityFileLineSnippetContext
LOWTools/ci/onboard.py38CODE
LOWml-agents/tests/yamato/check_coverage_percent.py7CODE
LOWml-agents/tests/yamato/scripts/run_llapi.py9CODE
LOWml-agents/mlagents/trainers/upgrade_config.py17CODE
LOWml-agents/mlagents/trainers/upgrade_config.py103CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py116CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py330CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py406CODE
LOWml-agents/mlagents/trainers/trajectory.py145CODE
LOWml-agents/mlagents/trainers/demo_loader.py105CODE
LOWml-agents/mlagents/trainers/demo_loader.py174CODE
LOWml-agents/mlagents/trainers/agent_processor.py90CODE
LOWml-agents/mlagents/trainers/agent_processor.py212CODE
LOWml-agents/mlagents/trainers/agent_processor.py441CODE
LOWml-agents/mlagents/trainers/settings.py671CODE
LOWml-agents/mlagents/trainers/settings.py894CODE
LOW…s/mlagents/trainers/training_analytics_side_channel.py54CODE
LOWml-agents/mlagents/trainers/simple_env_manager.py50CODE
LOW…nts/mlagents/trainers/environment_parameter_manager.py62CODE
LOW…nts/mlagents/trainers/environment_parameter_manager.py135CODE
LOWml-agents/mlagents/trainers/sac/optimizer_torch.py277CODE
LOWml-agents/mlagents/trainers/tests/simple_test_envs.py427CODE
LOWml-agents/mlagents/trainers/tests/simple_test_envs.py501CODE
LOWml-agents/mlagents/trainers/tests/test_settings.py45CODE
LOWml-agents/mlagents/trainers/ghost/trainer.py219CODE
LOWml-agents/mlagents/trainers/torch_entities/layers.py62CODE
LOW…nts/mlagents/trainers/model_saver/torch_model_saver.py85CODE
LOWml-agents/mlagents/trainers/trainer/rl_trainer.py278CODE
LOWutils/validate_release_links.py143CODE
LOWutils/validate_meta_files.py4CODE
LOWml-agents-envs/mlagents_envs/env_utils.py20CODE
LOWml-agents-envs/mlagents_envs/rpc_utils.py317CODE
LOWml-agents-envs/mlagents_envs/registry/binary_utils.py27CODE
LOWml-agents-envs/mlagents_envs/registry/binary_utils.py70CODE
LOW…s-envs/mlagents_envs/envs/unity_pettingzoo_base_env.py112CODE
LOW…s-envs/mlagents_envs/envs/unity_pettingzoo_base_env.py147CODE
LOWml-agents-envs/tests/simple_test_envs.py374CODE
LOWml-agents-envs/tests/simple_test_envs.py450CODE
LOWml-agents-envs/tests/test_timers.py12CODE
Modern Structural Boilerplate36 hits · 36 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/torch_utils/torch.py42def set_torch_config(torch_settings: TorchSettings) -> None:CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py449 def set_env_parameters(self, config: Dict = None) -> None:CODE
LOWml-agents/mlagents/trainers/env_manager.py45 def set_policy(self, brain_name: BehaviorName, policy: Policy) -> None:CODE
LOWml-agents/mlagents/trainers/env_manager.py72 def set_env_parameters(self, config: Dict = None) -> None:CODE
LOWml-agents/mlagents/trainers/training_status.py100 def set_parameter_state(category: str, key: StatusType, value: Any) -> None:CODE
LOWml-agents/mlagents/trainers/stats.py343 def set_stat(self, key: str, value: float) -> None:CODE
LOWml-agents/mlagents/trainers/settings.py738 def set_config_specified(self, require_config_specified: bool) -> None:CODE
LOWml-agents/mlagents/trainers/simple_env_manager.py50 def set_env_parameters(self, config: Dict = None) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/encoders.py108 def update_normalization(self, inputs: torch.Tensor) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py86 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py225 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py327 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py436 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py479 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py513 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/networks.py619 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWml-agents/mlagents/trainers/torch_entities/utils.py54 def update_learning_rate(optim: torch.optim.Optimizer, lr: float) -> None:CODE
LOWml-agents/mlagents/trainers/poca/optimizer_torch.py84 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOW…agents/mlagents/trainers/trainer/off_policy_trainer.py237 def _update_reward_signals(self) -> None:CODE
LOWml-agents/mlagents/trainers/trainer/rl_trainer.py70 def _update_end_episode_stats(self, agent_id: str, optimizer: Optimizer) -> None:CODE
LOW…er-plugin/mlagents_trainer_plugin/dqn/dqn_optimizer.py210 def update_normalization(self, buffer: AgentBuffer) -> None:CODE
LOWutils/validate_versions.py94def set_package_version(new_version: str) -> None:STRING
LOWml-agents-envs/mlagents_envs/logging_util.py43def set_log_level(log_level: int) -> None:CODE
LOWml-agents-envs/mlagents_envs/logging_util.py60def _set_formatter_for_all_loggers(formatter: logging.Formatter) -> None:CODE
LOWml-agents-envs/mlagents_envs/base_env.py584 def set_actions(self, behavior_name: BehaviorName, action: ActionTuple) -> None:CODE
LOWml-agents-envs/mlagents_envs/environment.py287 def _update_behavior_specs(self, output: UnityOutputProto) -> None:CODE
LOWml-agents-envs/mlagents_envs/environment.py299 def _update_state(self, output: UnityRLOutputProto) -> None:CODE
LOWml-agents-envs/mlagents_envs/environment.py367 def set_actions(self, behavior_name: BehaviorName, action: ActionTuple) -> None:CODE
LOWml-agents-envs/mlagents_envs/timers.py226 def set_gauge(self, name: str, value: float) -> None:CODE
LOWml-agents-envs/mlagents_envs/timers.py313def set_gauge(name: str, value: float, timer_stack: TimerStack = None) -> None:CODE
LOW…ts-envs/mlagents_envs/side_channel/outgoing_message.py56 def set_raw_bytes(self, buffer: bytearray) -> None:CODE
LOW…ents_envs/side_channel/engine_configuration_channel.py123 def set_configuration(self, config: EngineConfig) -> None:CODE
LOW…mlagents_envs/side_channel/float_properties_channel.py29 def set_property(self, key: str, value: float) -> None:CODE
LOW…ts_envs/side_channel/environment_parameters_channel.py34 def set_float_parameter(self, key: str, value: float) -> None:CODE
LOW…s-envs/mlagents_envs/envs/unity_pettingzoo_base_env.py76 def _update_observation_spaces(self) -> None:CODE
LOW…s-envs/mlagents_envs/envs/unity_pettingzoo_base_env.py112 def _update_action_spaces(self) -> None:CODE
Hallucination Indicators3 hits · 30 pts
SeverityFileLineSnippetContext
CRITICAL…agents/Runtime/Grpc/CommunicatorObjects/Observation.cs350 FloatData = new global::Unity.MLAgents.CommunicatorObjects.ObservationProto.Types.FloatData();CODE
CRITICAL…agents/Runtime/Grpc/CommunicatorObjects/Observation.cs381 global::Unity.MLAgents.CommunicatorObjects.ObservationProto.Types.FloatData subBuilder = new global::Unity.MCODE
CRITICAL…s/Runtime/SideChannels/TrainingAnalyticsSideChannel.cs29 anyMessage = Google.Protobuf.WellKnownTypes.Any.Parser.ParseFrom(msg.GetRawBytes());CODE
Unused Imports29 hits · 29 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/torch_utils/__init__.py1CODE
LOWml-agents/mlagents/torch_utils/__init__.py2CODE
LOWml-agents/mlagents/torch_utils/__init__.py3CODE
LOWml-agents/mlagents/torch_utils/__init__.py4CODE
LOWml-agents/mlagents/trainers/optimizer/__init__.py1CODE
LOW…ts/mlagents/trainers/tests/torch_entities/test_poca.py8CODE
LOW…nts/mlagents/trainers/tests/torch_entities/test_sac.py6CODE
LOW…torch_entities/components/reward_providers/__init__.py1CODE
LOW…torch_entities/components/reward_providers/__init__.py4CODE
LOW…torch_entities/components/reward_providers/__init__.py7CODE
LOW…torch_entities/components/reward_providers/__init__.py10CODE
LOW…torch_entities/components/reward_providers/__init__.py13CODE
LOW…torch_entities/components/reward_providers/__init__.py16CODE
LOWml-agents/mlagents/trainers/trainer/__init__.py1CODE
LOWml-agents/mlagents/trainers/trainer/__init__.py2CODE
LOWml-agents/mlagents/trainers/policy/__init__.py1CODE
LOW…envs/mlagents_envs/communicator_objects/command_pb2.py8CODE
LOW…envs/mlagents_envs/communicator_objects/command_pb2.py9CODE
LOW…s/mlagents_envs/communicator_objects/space_type_pb2.py8CODE
LOW…s/mlagents_envs/communicator_objects/space_type_pb2.py9CODE
LOW…nts_envs/communicator_objects/unity_to_external_pb2.py7CODE
LOW…nts_envs/communicator_objects/unity_to_external_pb2.py8CODE
LOW…nts_envs/communicator_objects/unity_to_external_pb2.py15CODE
LOWml-agents-envs/mlagents_envs/registry/__init__.py1CODE
LOWml-agents-envs/mlagents_envs/registry/__init__.py1CODE
LOWml-agents-envs/mlagents_envs/side_channel/__init__.py1CODE
LOWml-agents-envs/mlagents_envs/side_channel/__init__.py2CODE
LOWml-agents-envs/mlagents_envs/side_channel/__init__.py4CODE
LOWml-agents-envs/mlagents_envs/side_channel/__init__.py5CODE
Self-Referential Comments9 hits · 23 pts
SeverityFileLineSnippetContext
MEDIUMml-agents/mlagents/trainers/tests/test_demo_loader.py120 # Create a metadata proto with an unsupported versionCOMMENT
MEDIUMml-agents/mlagents/trainers/tests/__init__.py5 # This file is importer by pytest multiple times, but this breaks the patchingCOMMENT
MEDIUM…ents/mlagents/trainers/torch_entities/distributions.py131 # This function is equivalent to torch.diag(self.probs.T[value.flatten().long()]),COMMENT
MEDIUMml-agents/mlagents/trainers/model_saver/model_saver.py7 """This class is the base class for the ModelSaver"""STRING
MEDIUMml-agents/mlagents/trainers/ppo/optimizer_torch.py44 # Create the graph here to give more granular control of the TF graph to the Optimizer.COMMENT
MEDIUMml-agents/mlagents/trainers/poca/optimizer_torch.py163 # Create the graph here to give more granular control of the TF graph to the Optimizer.COMMENT
MEDIUMml-agents/mlagents/trainers/trainer/trainer.py20 """This class is the base class for the mlagents_envs.trainers"""STRING
MEDIUM…er-plugin/mlagents_trainer_plugin/a2c/a2c_optimizer.py49 # Create the graph here to give more granular control of the TF graph to the Optimizer.COMMENT
MEDIUM…nvs/communicator_objects/unity_to_external_pb2_grpc.py48 # This class is part of an EXPERIMENTAL API.COMMENT
Redundant / Tautological Comments12 hits · 18 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/trainers/learn.py74 # Check if directory existsCOMMENT
LOWml-agents/mlagents/trainers/settings.py49 # Check if beta and epsilon are set. If not, set to match learning rate schedule.COMMENT
LOWml-agents/mlagents/trainers/settings.py605 # Assign team_change to about 4x save_stepsCOMMENT
LOWml-agents/mlagents/trainers/settings.py682 # Check if a default_settings was specified. If so, used those as the defaultCOMMENT
LOWml-agents/mlagents/trainers/sac/trainer.py94 # Check if we used group rewards, warn if so.COMMENT
LOW…nts/mlagents/trainers/tests/torch_entities/test_ppo.py180 # Check if buffer size is too bigCOMMENT
LOW…nts/mlagents/trainers/tests/torch_entities/test_ppo.py237 # Check if we ignore terminal states properlyCOMMENT
LOW…ts/mlagents/trainers/tests/torch_entities/test_poca.py182 # Check if we ignore terminal states properlyCOMMENT
LOW…ts/mlagents/trainers/tests/torch_entities/test_poca.py281 # Check if buffer size is too bigCOMMENT
LOWml-agents/mlagents/trainers/ppo/trainer.py78 # Check if we used group rewards, warn if so.COMMENT
LOW…iner-plugin/mlagents_trainer_plugin/dqn/dqn_trainer.py63 # Check if we used group rewards, warn if so.COMMENT
LOW…iner-plugin/mlagents_trainer_plugin/a2c/a2c_trainer.py76 # Check if we used group rewards, warn if so.COMMENT
Structural Annotation Overuse10 hits · 15 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/utils/push_to_hf.py64 # Step 1: Read the config.jsonCOMMENT
LOWml-agents/mlagents/utils/push_to_hf.py72 # Step 2: Create the metadataCOMMENT
LOWml-agents/mlagents/utils/push_to_hf.py75 # Step 3: Generate the model cardCOMMENT
LOWml-agents/mlagents/utils/push_to_hf.py148 # Step 1: Create the repoSTRING
LOWml-agents/mlagents/utils/push_to_hf.py158 # Step 2: Create a config fileSTRING
LOWml-agents/mlagents/utils/push_to_hf.py161 # Step 3: Generate and save the model cardSTRING
LOW…gents/Documentation~/Tutorial-Custom-Trainer-Plugin.md5### Step 1: Write your custom trainer classCOMMENT
LOW…gents/Documentation~/Tutorial-Custom-Trainer-Plugin.md114### Step 2: implement your custom optimizer for the trainer.COMMENT
LOW…gents/Documentation~/Tutorial-Custom-Trainer-Plugin.md196### Step 3: Integrate your custom trainer into the plugin systemCOMMENT
LOW…gents/Documentation~/Tutorial-Custom-Trainer-Plugin.md239### Step 4: Install your custom trainer and run training:COMMENT
Excessive Try-Catch Wrapping11 hits · 14 pts
SeverityFileLineSnippetContext
MEDIUMml-agents/tests/yamato/training_int_tests.py156 print("Error running inference!")CODE
LOWml-agents/mlagents/trainers/subprocess_env_manager.py228 except Exception as ex:CODE
LOWml-agents/mlagents/trainers/trainer_controller.py88 except Exception:CODE
LOWml-agents/mlagents/trainers/trainer_controller.py280 except Exception:CODE
MEDIUMml-agents/mlagents/trainers/trainer_controller.py84def _create_output_path(output_path):CODE
LOWml-agents/mlagents/trainers/learn.py228 except Exception:CODE
LOWml-agents/mlagents/trainers/tests/test_torch_utils.py38 except Exception:CODE
MEDIUMml-agents/mlagents/trainers/tests/test_torch_utils.py21def test_set_torch_device(CODE
LOWml-agents-envs/mlagents_envs/rpc_communicator.py74 except Exception:CODE
LOWml-agents-envs/mlagents_envs/environment.py510 except Exception:CODE
LOWml-agents-envs/mlagents_envs/registry/binary_utils.py52 except Exception:CODE
Modern AI Meta-Vocabulary5 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUMml-agents/mlagents/trainers/torch_entities/networks.py290 # Modules for multi-agent self-attentionCOMMENT
MEDIUMml-agents-envs/mlagents_envs/environment.py67 # * 1.5.0 - support variable length observation training and multi-agent groups.COMMENT
MEDIUM…m.unity.ml-agents/Documentation~/ML-Agents-Overview.md195See our [Designing Agents](Learning-Environment-Design-Agents.md#defining-multi-agent-scenarios) page for more informatiCODE
MEDIUMcom.unity.ml-agents/Documentation~/index.md7This documentation contains comprehensive instructions about [Unity ML-Agents Toolkit](https://github.com/Unity-TechnoloCODE
MEDIUMcom.unity.ml-agents/Documentation~/Migrating.md405- We have removed the `Done` call as well as the capacity to set `Max Steps` on the Academy. Therefore, an AcademyReset CODE
AI Structural Patterns11 hits · 11 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/trainers/trajectory.py116CODE
LOWml-agents/mlagents/trainers/trajectory.py133CODE
LOW…s/mlagents/trainers/training_analytics_side_channel.py45CODE
LOWml-agents/mlagents/trainers/tests/simple_test_envs.py42CODE
LOWml-agents/mlagents/trainers/tests/simple_test_envs.py351CODE
LOWml-agents/mlagents/trainers/torch_entities/attention.py265CODE
LOW…gents/mlagents/trainers/torch_entities/conditioning.py133CODE
LOWml-agents-envs/mlagents_envs/environment.py145CODE
LOW…nvs/communicator_objects/unity_to_external_pb2_grpc.py53CODE
LOWml-agents-envs/tests/simple_test_envs.py46CODE
LOWml-agents-envs/tests/simple_test_envs.py297CODE
Verbosity Indicators7 hits · 10 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/utils/push_to_hf.py64 # Step 1: Read the config.jsonCOMMENT
LOWml-agents/mlagents/utils/push_to_hf.py72 # Step 2: Create the metadataCOMMENT
LOWml-agents/mlagents/utils/push_to_hf.py75 # Step 3: Generate the model cardCOMMENT
LOWml-agents/mlagents/utils/push_to_hf.py148 # Step 1: Create the repoSTRING
LOWml-agents/mlagents/utils/push_to_hf.py158 # Step 2: Create a config fileSTRING
LOWml-agents/mlagents/utils/push_to_hf.py161 # Step 3: Generate and save the model cardSTRING
LOWml-agents/mlagents/trainers/tests/test_buffer.py208 # We need to check if we ever get a breaking start - this will maximize the probabilityCOMMENT
AI Slop Vocabulary4 hits · 9 pts
SeverityFileLineSnippetContext
LOW…agents/trainers/tests/torch_entities/test_simple_rl.py450 # Otherwise, we can just call solve to execute the optimal policyCOMMENT
LOWml-agents-envs/mlagents_envs/registry/binary_utils.py133 # TODO: Once we don't use python 3.7 we should just use exists_ok=True when creating the dirs to avoid this.COMMENT
MEDIUM…nts/Runtime/Input/Adaptors/ButtonInputActionAdaptor.cs17 /// TODO this method needs to be more nuanced depending the types of controls that can back it. i.e. TriggerConCOMMENT
MEDIUM…nts/Runtime/Input/Adaptors/ButtonInputActionAdaptor.cs29 /// TODO again this might need to be more nuanced for things like continuous buttons.COMMENT
Slop Phrases4 hits · 6 pts
SeverityFileLineSnippetContext
LOWml-agents/mlagents/trainers/env_manager.py116 # We make sure to empty the policy queue before continuing to produce steps.COMMENT
LOWml-agents/mlagents/trainers/trainer_controller.py195 # If the environment failed, we want to make sure to raiseCOMMENT
LOWml-agents/mlagents/trainers/agent_processor.py435 # In the environment manager, we make sure to empty the policy queue before continuing to produce steps.COMMENT
LOW…nts/mlagents/trainers/tests/torch_entities/test_ppo.py207 # Time horizon is longer than sequence length, make sure to testCOMMENT
Cross-Language Confusion1 hit · 5 pts
SeverityFileLineSnippetContext
HIGHml-agents-envs/mlagents_envs/timers.py277 timer_node = timer_stack.push(name)CODE
Fake / Example Data2 hits · 2 pts
SeverityFileLineSnippetContext
LOW…ests/Tests/Editor/TrainingAnalyticsSideChannelTests.cs48 var badBytes = Encoding.ASCII.GetBytes("Lorem ipsum");CODE
LOWDevProject/Assets/placeholder.txt1lorem ipsumCODE
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippetContext
LOWcom.unity.ml-agents/Runtime/Timer.cs352 /// Example usage:COMMENT