sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstablesudo nix-channel --update nixos-unstableIn order to check similarity between 2 vectors, we can check the distance between them. There are a few different metrics to measure distance between 2 vectors.
import numpy as npMeasures the angle between 2 non-zero vectors. It ranges between
def cosine_similarity(p, q):| [shell] | |
| program = "wsl" | |
| args = [ "~" ] | |
| [font] | |
| size = 12 | |
| [font.normal] | |
| family = "CodeNewRoman Nerd Font" | |
| style = "Regular" |
| Aspect | On-Policy | Off-Policy |
|---|---|---|
| Definition | Learns the value function for the policy being used for action selection | Can learn about a different policy than the one being used for action selection |
| Policy Updating | Uses the same policy for both learning and action selection | Can use different policies for learning and action selection |
| Data Collection | Collects data using the current policy | Can use data collected from any policy |
| Exploration | Typically requires a balance between exploration and exploitation | Can learn from data collected u |
| import torch | |
| import numpy as np | |
| def check_gpu_capabilities(): | |
| print("=== GPU Information ===") | |
| if not torch.cuda.is_available(): | |
| print("❌ CUDA is not available on this system") | |
| return | |
uv init dir_name will create a new python project
uv init . in an existing project directoryuv run script.py will run script.py. No need to activate venv, uv will take care of ituv add lib_name will pull lib_name from pypi and add it to projectuv remove lib_name will remove lib_name from the envuv lock will generate a lockfileuv sync will make the venv in sync with lockfile, installing and removing as requireduv pip install -r requirements.txt in an existing project directory