126 lines
4.8 KiB
Plaintext
126 lines
4.8 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "508336f4",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from kg_ocr import get_screenshots, extract_text, create_and_index, retrieve, ask_wllm"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"id": "11055f85",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.\n"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"application/vnd.jupyter.widget-view+json": {
|
|
"model_id": "20e3c61fe191485da79a32e823ccd1ec",
|
|
"version_major": 2,
|
|
"version_minor": 0
|
|
},
|
|
"text/plain": [
|
|
"Loading weights: 0%| | 0/103 [00:00<?, ?it/s]"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\u001b[1mBertModel LOAD REPORT\u001b[0m from: sentence-transformers/all-MiniLM-L6-v2\n",
|
|
"Key | Status | | \n",
|
|
"------------------------+------------+--+-\n",
|
|
"embeddings.position_ids | UNEXPECTED | | \n",
|
|
"\n",
|
|
"\u001b[3mNotes:\n",
|
|
"- UNEXPECTED\u001b[3m\t:can be ignored when loading from different task/architecture; not ok if you expect identical arch.\u001b[0m\n"
|
|
]
|
|
},
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[0.739] This slide focuses on the effect of slow fluctuations in population size on the effective\n",
|
|
"population size (V.) and emphasizes the conditions under whi...\n",
|
|
"[0.722] This slide explains how rapid fluctuations in population size influence the effective population size\n",
|
|
"(N-), a key parameter in population genetics. Un...\n",
|
|
"[0.712] Variable population size\n",
|
|
"\n",
|
|
"Beyond the Standard Neutral Model\n",
|
|
"\n",
|
|
"Slow fluctuations\n",
|
|
"in population size : = =\n",
|
|
"\n",
|
|
"4 Need:\n",
|
|
"A, 7 T << min[N, |\n",
|
|
"\n",
|
|
"...\n",
|
|
"## How Population Size Fluctuations Affect Effective Population Size\n",
|
|
"\n",
|
|
"Based on the provided documents, population size fluctuations significantly impact effective population size (Ne) in the following ways:\n",
|
|
"\n",
|
|
"**1. Harmonic Mean Effect**\n",
|
|
"Unlike the arithmetic mean, Ne reflects the *harmonic mean* of population sizes over time. This is disproportionately affected by periods of small population size. For example, if a population fluctuates between N and N/4, the effective population size becomes N/2—\"significantly smaller than the actual average population size\" (first slide).\n",
|
|
"\n",
|
|
"**2. Reduction from Small Population Periods**\n",
|
|
"Smaller populations have higher probabilities of coalescence, which reduces genetic diversity. Even brief reductions in population size can greatly lower Ne. This is because \"smaller populations have higher probabilities of coalescence, reducing genetic diversity\" (first slide).\n",
|
|
"\n",
|
|
"**3. Time Scale Matters**\n",
|
|
"The effect depends on whether fluctuations are rapid or slow:\n",
|
|
"- **Rapid fluctuations**: The harmonic mean formula accurately represents Ne over the fluctuation period.\n",
|
|
"- **Slow fluctuations**: Occur when the time period of interest (T') is \"much shorter than the minimum population size (min[Nt]) across the fluctuation cycle\" (second slide). In this case, population size appears relatively stable, and \"the harmonic mean formula may not accurately represent the effective population size over longer periods\" (second slide).\n",
|
|
"\n",
|
|
"The key takeaway is that for meaningful harmonic mean calculation, \"the time scale of observation (T') must be significantly smaller than the scale of population size changes\" (second slide).\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"screenshots = get_screenshots(\"/Users/Aman/Pictures\")\n",
|
|
"texts = extract_text(screenshots)\n",
|
|
"embeddings = create_and_index(texts)\n",
|
|
"results = retrieve(embeddings, \"population size fluctuations\")\n",
|
|
"for r in results:\n",
|
|
" print(f\"[{r['score']:.3f}] {r['text'][:150]}...\")\n",
|
|
"\n",
|
|
"answer = ask_wllm(embeddings, \"How do population size fluctuations affect effective population size?\")\n",
|
|
"print(answer)"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "base",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.12.7"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|