-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.xml
696 lines (534 loc) · 116 KB
/
index.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Welcome!</title>
<link>https://mmel099.github.io/</link>
<atom:link href="https://mmel099.github.io/index.xml" rel="self" type="application/rss+xml" />
<description>Welcome!</description>
<generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Mon, 24 Oct 2022 00:00:00 +0000</lastBuildDate>
<image>
<url>https://mmel099.github.io/media/icon_hubd979b96828314d34ff1ac73d4ae29ee_17978_512x512_fill_lanczos_center_3.png</url>
<title>Welcome!</title>
<link>https://mmel099.github.io/</link>
</image>
<item>
<title>Car Market Analysis: Finding High Discount Listings</title>
<link>https://mmel099.github.io/project/used-car-finder/</link>
<pubDate>Wed, 28 Aug 2024 00:00:00 +0000</pubDate>
<guid>https://mmel099.github.io/project/used-car-finder/</guid>
<description><h2 id="car-database">Car Database</h2>
<table>
<thead>
<tr>
<th><em>Page</em></th>
<th><em>Note</em></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="data/daily.html"><em>Last Day</em></a></td>
<td>Last day of car listings</td>
</tr>
<tr>
<td><a href="data/weekly.html"><em>Last 7 Days</em></a></td>
<td>Last week of car listings</td>
</tr>
<tr>
<td><a href="data/monthly.html"><em>Last 30 Days</em></a></td>
<td>Last month of car listings</td>
</tr>
</tbody>
</table>
<h2 id="description">Description</h2>
<p>The <a href="https://www.auto.dev/listings" target="_blank" rel="noopener">AutoDev API</a> was accessed to gather the data necessary to train the model. Toyota Camrys were used for this project due to their popularity and desirability. Cars produced before 2015 were not included. There were no mileage parameters, meaning new cars were included in the training set. Additionally, a radius of 150 miles around Boston was imposed for this search. Most (~85%) Camrys that fit this criteria fell into one of four trims: LE, SE, XLE, XSE. These four were the only ones considered for this project.</p>
<p>In the regression model, trim was expanded into dummy (indicator) variables for each trim. Mileage was included as a simple linear effect. Year was incorporated in a complex way: after converting model year into an integer age each age was further log transformed to account for the marginally decreasing depreciation rate with each additional year of age. The rationale behind this decision came from the logic that a change from &lsquo;year 1&rsquo; to &lsquo;year 2&rsquo; should be more significant than &lsquo;year 6&rsquo; to &lsquo;year 7&rsquo;. Furthermore, each year was granted its own dummy (indicator) variable as well. This added flexibility was introduced to qualify how the data deviates from the assumed log year term. The final model was selected using likelihood ratio tests.</p>
<p>The next step of this project lead me into the area of automation. After generating a script that made a new API call and ran it through the pre-trained regression model. This step produced an estimated price of the car. Comparison of this price with the actual price of the vehicle lead to discount prices. The automation step of this project was a bit tricky but was accomplished with GitHub Actions and YAML. By using YAML files, I enabled an automatic trigger for my API script to run every day. Following this, another script pushed these change to this website.</p>
</description>
</item>
<item>
<title>Hodgkin-Huxley Model</title>
<link>https://mmel099.github.io/post/hodgkin-huxley/</link>
<pubDate>Sat, 06 Jan 2024 00:00:00 +0000</pubDate>
<guid>https://mmel099.github.io/post/hodgkin-huxley/</guid>
<description><p>The Hodgkin-Huxley model stands as a milestone in neuroscience, offering a comprehensive framework to comprehend the intricate dynamics of neuronal excitability. Developed by Sir Alan Lloyd Hodgkin and Sir Andrew Fielding Huxley in 1952, this model has been pivotal in shaping our understanding of how neurons generate and propagate electrical signals. In this blog post, we embark on a journey into the depths of the Hodgkin-Huxley neural model, exploring its inception, key components, and its profound impact on neuroscience.</p>
<h3 id="the-birth-of-hodgkin-huxley-model">The Birth of Hodgkin-Huxley Model:</h3>
<p>The Hodgkin-Huxley model emerged as a result of pioneering experiments conducted on the giant axon of the squid. Hodgkin and Huxley meticulously studied the ion currents across the neuronal membrane, aiming to unravel the mechanisms underlying action potentials. Their groundbreaking work, which earned them the Nobel Prize in Physiology or Medicine in 1963, laid the foundation for the Hodgkin-Huxley model.</p>
<h3 id="understanding-neuronal-excitability">Understanding Neuronal Excitability:</h3>
<p>The Hodgkin-Huxley model provides a mathematical description of the electrical activity in neurons. At its core, the model is based on the principles of ion channels and the flow of ions across the cell membrane. Sodium (Na+), potassium (K+), and leak channels play pivotal roles in shaping the dynamics of action potentials.</p>
<h3 id="components-of-the-hodgkin-huxley-model">Components of the Hodgkin-Huxley Model:</h3>
<p><em>Membrane Potential (Vm):</em> The electric potential difference across the neuronal membrane. It is a dynamic variable influenced by ion currents and governs the excitability of the neuron.</p>
<p><em>Voltage-Gated Ion Channels (Na+, K+):</em> Membrane structures that facilitate the transport of ions based on the membrane potential</p>
<ul>
<li>Sodium channels are responsible for the rapid influx of sodium ions during depolarization</li>
<li>Potassium channels mediate the outward flow of potassium ions during repolarization</li>
</ul>
<p><em>Leak Channels:</em> Contribute to the resting membrane potential by allowing a continuous, passive flow of ions along the concentration gradient. While not as selective as voltage-gated channels, leak channels help maintain the baseline membrane potential.</p>
<p><em>Current (
$I_{\text{app}}, I_{\text{Na}}, I_{\text{K}}, I_{\text{L}}$):</em> Movement of charged particles across a membrane. In this mode, there are four sources of current: Iapp which is externally applied to the neuron and the three currents produced by movement of ions through the sodium, potassium and leak channels described above.</p>
<p><em>Gating Variables (m, h, n):</em> Gating variables represent the activation and inactivation states of sodium and potassium channels.</p>
<ul>
<li>m represents the activation of sodium channels.</li>
<li>h represents the inactivation of sodium channels.</li>
<li>n represents the activation of potassium channels.</li>
</ul>
<p><em>Transition Rate Constanst (α, β):</em>
These factors guide the dynamics of ion channel state changes.</p>
<ul>
<li>α is the number of times per second that a gate which is in the shut state opens</li>
<li>β is the number of times per second that a gate which is in the open state shuts</li>
</ul>
<h3 id="mathematical-formulation">Mathematical Formulation:</h3>
<p>The model&rsquo;s equations involve differential equations that use Euler&rsquo;s method to describe the changes in membrane potential and ion concentrations over time. These equations elegantly capture the complex interplay between ion channels, enabling simulations of action potentials under various conditions.</p>
<h3 id="membrane-potential-equation">Membrane Potential Equation</h3>
$$ C_m \frac{dV}{dt} = I_{\text{app}} + I_{\text{Na}} + I_{\text{K}} + I_{\text{L}} $$
<h3 id="sodium-current-equation">Sodium Current Equation</h3>
$$ I_{\text{Na}} = g_{\text{Na}}m^3h(E_{\text{Na}} - V_m) $$
<h3 id="potassium-current-equation">Potassium Current Equation</h3>
$$ I_{\text{K}} = g_{\text{K}}n^4(E_{\text{K}} - V_m) $$
<h3 id="leak-current-equation">Leak Current Equation</h3>
$$ I_{\text{L}} = g_{\text{L}}(E_{\text{L}} - V_m) $$
<h3 id="gating-variables-equations">Gating Variables Equations</h3>
$$ \frac{dm}{dt} = \alpha_m(1 - m) - \beta_mm $$
$$ \frac{dh}{dt} = \alpha_h(1 - h) - \beta_hh $$
$$ \frac{dn}{dt} = \alpha_n(1 - n) - \beta_nn $$
<h3 id="alpha-hahahugoshortcode12s6hbhb-and-beta-hahahugoshortcode12s7hbhb-formulas">Alpha
$(\alpha)$ and Beta
$(\beta)$ Formulas</h3>
<p>
\begin{align*}
\text{For } m: & \quad \alpha_m = \frac{10^5 (-V_m - 0.045)}{\exp(100 (-V_m - 0.045)) - 1} \\
& \quad \beta_m = 4 \times 10^3 \exp\left(\frac{-V_m - 0.070}{0.018}\right) \\
\\
\text{For } h: & \quad \alpha_h = 70 \exp(50 (-V_m - 0.070)) \\
& \quad \beta_h = \frac{10^3}{\exp(100 (-V_m - 0.040)) + 1} \\
\\
\text{For } n: & \quad \alpha_n = \begin{cases} 100 & \text{if } V_m = -0.060 \\ \frac{10^4 (-V_m - 0.060)}{\exp(100 (-V_m - 0.060)) - 1} & \text{otherwise} \end{cases} \\
& \quad \beta_n = 125 \exp\left(\frac{-V_m - 0.070}{0.08}\right) \\
\end{align*}
Note: The if statement applies L'Hôpital's rule to calculate $\alpha_n$.
<br></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-matlab" data-lang="matlab"><span class="line"><span class="cl"><span class="k">function</span><span class="w"> </span><span class="nf">HodgkinHuxley</span><span class="p">()</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c">% This is a famous neuron model developped by Hodgkin and Huxley</span>
</span></span><span class="line"><span class="cl"> <span class="c">% There are four time-dependent variables: sodium activation, sodium inactivation, </span>
</span></span><span class="line"><span class="cl"> <span class="c">% potassium activation, and membrane potential</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% Default model parameters</span>
</span></span><span class="line"><span class="cl"> <span class="n">Gl</span> <span class="p">=</span> <span class="mi">3</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">8</span><span class="p">;</span> <span class="c">% Leak Conductance (S)</span>
</span></span><span class="line"><span class="cl"> <span class="n">Gna</span> <span class="p">=</span> <span class="mf">1.2</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">5</span><span class="p">;</span> <span class="c">% Maximum Sodium Conductance (S)</span>
</span></span><span class="line"><span class="cl"> <span class="n">Gk</span> <span class="p">=</span> <span class="mf">3.6</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">6</span><span class="p">;</span> <span class="c">% Maximum Delayed Rectifier Conductance (S)</span>
</span></span><span class="line"><span class="cl"> <span class="n">Ena</span> <span class="p">=</span> <span class="mf">4.5</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">2</span><span class="p">;</span> <span class="c">% Sodium Reversal Potential (V)</span>
</span></span><span class="line"><span class="cl"> <span class="n">Ek</span> <span class="p">=</span> <span class="o">-</span><span class="mf">8.2</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">2</span><span class="p">;</span> <span class="c">% Potassium Reversal potential (V)</span>
</span></span><span class="line"><span class="cl"> <span class="n">El</span> <span class="p">=</span> <span class="o">-</span><span class="mi">6</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">2</span><span class="p">;</span> <span class="c">% Leak Reversal potential (V)</span>
</span></span><span class="line"><span class="cl"> <span class="n">Cm</span> <span class="p">=</span> <span class="mi">10</span>^<span class="o">-</span><span class="mi">10</span><span class="p">;</span> <span class="c">% Membrane capacitance (F)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% Initial conditions</span>
</span></span><span class="line"><span class="cl"> <span class="n">conditions</span> <span class="p">=</span> <span class="p">[</span><span class="n">El</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">0</span><span class="p">];</span> <span class="c">% [Vm m h n]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% Default simulation parameters</span>
</span></span><span class="line"><span class="cl"> <span class="n">tmax</span> <span class="p">=</span> <span class="mf">0.35</span><span class="p">;</span> <span class="c">% Duration of trial</span>
</span></span><span class="line"><span class="cl"> <span class="n">delta</span> <span class="p">=</span> <span class="mf">0.00001</span><span class="p">;</span> <span class="c">% Step size</span>
</span></span><span class="line"><span class="cl"> <span class="n">nSteps</span> <span class="p">=</span> <span class="n">int32</span><span class="p">((</span><span class="n">tmax</span><span class="p">)</span><span class="o">/</span><span class="n">delta</span><span class="p">);</span> <span class="c">% Number of steps in a simulation</span>
</span></span><span class="line"><span class="cl"> <span class="n">Iapp</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span> <span class="c">% Applied current throughout the trial</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% This function calculates rate constants based on the value of Vm</span>
</span></span><span class="line"><span class="cl"><span class="k"> function</span><span class="w"> </span>constants <span class="p">=</span><span class="w"> </span><span class="nf">gatingVariables</span><span class="p">(</span>Vm<span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c">% Gating variable m</span>
</span></span><span class="line"><span class="cl"> <span class="c">% Steady state: Am / (Am + Bm)</span>
</span></span><span class="line"><span class="cl"> <span class="c">% Time constant: 1 / (Am + Bm)</span>
</span></span><span class="line"><span class="cl"> <span class="n">Am</span> <span class="p">=</span> <span class="p">(</span><span class="mi">10</span>^<span class="mi">5</span> <span class="o">*</span> <span class="p">(</span><span class="o">-</span><span class="mi">1</span> <span class="o">*</span> <span class="n">Vm</span> <span class="o">-</span> <span class="mf">0.045</span><span class="p">))</span><span class="o">/</span><span class="p">(</span><span class="nb">exp</span><span class="p">(</span><span class="mi">100</span> <span class="o">*</span> <span class="p">(</span><span class="o">-</span><span class="mi">1</span> <span class="o">*</span> <span class="n">Vm</span> <span class="o">-</span> <span class="mf">0.045</span><span class="p">))</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Bm</span> <span class="p">=</span> <span class="mi">4</span> <span class="o">*</span> <span class="mi">10</span>^<span class="mi">3</span> <span class="o">*</span> <span class="nb">exp</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span> <span class="o">*</span> <span class="n">Vm</span> <span class="o">-</span> <span class="mf">0.070</span><span class="p">)</span><span class="o">/</span><span class="mf">0.018</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% Gating variable h</span>
</span></span><span class="line"><span class="cl"> <span class="c">% Steady state: Ah / (Ah + Bh)</span>
</span></span><span class="line"><span class="cl"> <span class="c">% Time constant: 1 / (Ah + Bh)</span>
</span></span><span class="line"><span class="cl"> <span class="n">Ah</span> <span class="p">=</span> <span class="mi">70</span> <span class="o">*</span> <span class="nb">exp</span><span class="p">(</span><span class="mi">50</span> <span class="o">*</span> <span class="p">(</span><span class="o">-</span><span class="mi">1</span> <span class="o">*</span> <span class="n">Vm</span> <span class="o">-</span> <span class="mf">0.070</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="n">Bh</span> <span class="p">=</span> <span class="mi">10</span>^<span class="mi">3</span> <span class="o">/</span> <span class="p">(</span><span class="nb">exp</span><span class="p">(</span><span class="mi">100</span> <span class="o">*</span> <span class="p">(</span><span class="o">-</span><span class="mi">1</span> <span class="o">*</span> <span class="n">Vm</span> <span class="o">-</span> <span class="mf">0.040</span><span class="p">))</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% Gating variable n</span>
</span></span><span class="line"><span class="cl"> <span class="c">% Steady state: An / (An + Bn)</span>
</span></span><span class="line"><span class="cl"> <span class="c">% Time constant: 1 / (An + Bn)</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">Vm</span> <span class="o">==</span> <span class="o">-</span><span class="mf">0.060</span> <span class="c">% L&#39;Hopital&#39;s rule used to calculate An in the case it is 0/0</span>
</span></span><span class="line"><span class="cl"> <span class="n">An</span> <span class="p">=</span> <span class="mi">100</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="k">else</span>
</span></span><span class="line"><span class="cl"> <span class="n">An</span> <span class="p">=</span> <span class="p">(</span><span class="mi">10</span>^<span class="mi">4</span> <span class="o">*</span> <span class="p">(</span><span class="o">-</span><span class="mi">1</span> <span class="o">*</span> <span class="n">Vm</span> <span class="o">-</span> <span class="mf">0.060</span><span class="p">))</span><span class="o">/</span><span class="p">(</span><span class="nb">exp</span><span class="p">(</span><span class="mi">100</span> <span class="o">*</span> <span class="p">(</span><span class="o">-</span><span class="mi">1</span> <span class="o">*</span> <span class="n">Vm</span> <span class="o">-</span> <span class="mf">0.060</span><span class="p">))</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="k">end</span>
</span></span><span class="line"><span class="cl"> <span class="n">Bn</span> <span class="p">=</span> <span class="mi">125</span> <span class="o">*</span> <span class="nb">exp</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span> <span class="o">*</span> <span class="n">Vm</span> <span class="o">-</span> <span class="mf">0.070</span><span class="p">)</span><span class="o">/</span><span class="mf">0.08</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">constants</span> <span class="p">=</span> <span class="p">[</span><span class="n">Am</span> <span class="n">Bm</span> <span class="n">Ah</span> <span class="n">Bh</span> <span class="n">An</span> <span class="n">Bn</span><span class="p">];</span>
</span></span><span class="line"><span class="cl"> <span class="k">end</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% Differential Equations for the Hodgkin Huxley Model</span>
</span></span><span class="line"><span class="cl"><span class="k"> function</span><span class="w"> </span>rates <span class="p">=</span><span class="w"> </span><span class="nf">differentialEquations</span><span class="p">(</span>Vm,Iapp,m,h,n<span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="n">constants</span> <span class="p">=</span> <span class="n">gatingVariables</span><span class="p">(</span><span class="n">Vm</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">dVm</span> <span class="p">=</span> <span class="p">(</span><span class="n">Gl</span> <span class="o">*</span> <span class="p">(</span><span class="n">El</span> <span class="o">-</span> <span class="n">Vm</span><span class="p">)</span> <span class="o">+</span> <span class="n">Gna</span> <span class="o">*</span> <span class="n">m</span>^<span class="mi">3</span> <span class="o">*</span> <span class="n">h</span> <span class="o">*</span> <span class="p">(</span><span class="n">Ena</span> <span class="o">-</span> <span class="n">Vm</span><span class="p">)</span> <span class="o">+</span> <span class="n">Gk</span> <span class="o">*</span> <span class="n">n</span>^<span class="mi">4</span> <span class="o">*</span> <span class="p">(</span><span class="n">Ek</span> <span class="o">-</span> <span class="n">Vm</span><span class="p">)</span> <span class="o">+</span> <span class="n">Iapp</span><span class="p">)</span><span class="o">/</span><span class="n">Cm</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">dm</span> <span class="p">=</span> <span class="n">constants</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">m</span><span class="p">)</span> <span class="o">-</span> <span class="n">constants</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">*</span> <span class="n">m</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">dh</span> <span class="p">=</span> <span class="n">constants</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">h</span><span class="p">)</span> <span class="o">-</span> <span class="n">constants</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="o">*</span> <span class="n">h</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">dn</span> <span class="p">=</span> <span class="n">constants</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">n</span><span class="p">)</span> <span class="o">-</span> <span class="n">constants</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span> <span class="o">*</span> <span class="n">n</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">rates</span> <span class="p">=</span> <span class="p">[</span><span class="n">dVm</span> <span class="n">dm</span> <span class="n">dh</span> <span class="n">dn</span><span class="p">];</span>
</span></span><span class="line"><span class="cl"> <span class="k">end</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% This function simulates one trial and returns various data in a cell</span>
</span></span><span class="line"><span class="cl"><span class="k"> function</span><span class="w"> </span>data<span class="p">=</span><span class="nf">simulate</span><span class="p">(</span>delta,nSteps,Iapp,conditions<span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c">% Gather initial conditions</span>
</span></span><span class="line"><span class="cl"> <span class="n">Vm</span> <span class="p">=</span> <span class="n">conditions</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">m</span> <span class="p">=</span> <span class="n">conditions</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">h</span> <span class="p">=</span> <span class="n">conditions</span><span class="p">(</span><span class="mi">3</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">n</span> <span class="p">=</span> <span class="n">conditions</span><span class="p">(</span><span class="mi">4</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% Initialize several data vectors and add first values</span>
</span></span><span class="line"><span class="cl"> <span class="n">VmData</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">mData</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">hData</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">nData</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">VmData</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="n">Vm</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">mData</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="n">m</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">hData</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="n">h</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">nData</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="p">=</span> <span class="n">n</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% This for loop iterates for each time point in the experiment</span>
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="nb">j</span><span class="p">=</span><span class="mi">2</span><span class="p">:</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span>
</span></span><span class="line"><span class="cl"> <span class="n">rates</span> <span class="p">=</span> <span class="n">differentialEquations</span><span class="p">(</span><span class="n">Vm</span><span class="p">,</span><span class="n">Iapp</span><span class="p">(</span><span class="nb">j</span><span class="p">),</span><span class="n">m</span><span class="p">,</span><span class="n">h</span><span class="p">,</span><span class="n">n</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Vm</span> <span class="p">=</span> <span class="n">Vm</span> <span class="o">+</span> <span class="p">(</span><span class="n">rates</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="n">delta</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">m</span> <span class="p">=</span> <span class="n">m</span> <span class="o">+</span> <span class="p">(</span><span class="n">rates</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">*</span> <span class="n">delta</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">h</span> <span class="p">=</span> <span class="n">h</span> <span class="o">+</span> <span class="p">(</span><span class="n">rates</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="o">*</span> <span class="n">delta</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">n</span> <span class="p">=</span> <span class="n">n</span> <span class="o">+</span> <span class="p">(</span><span class="n">rates</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="o">*</span> <span class="n">delta</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% Several pieces of data are recorded</span>
</span></span><span class="line"><span class="cl"> <span class="n">VmData</span><span class="p">(</span><span class="nb">j</span><span class="p">)</span> <span class="p">=</span> <span class="n">Vm</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">mData</span><span class="p">(</span><span class="nb">j</span><span class="p">)</span> <span class="p">=</span> <span class="n">m</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">hData</span><span class="p">(</span><span class="nb">j</span><span class="p">)</span> <span class="p">=</span> <span class="n">h</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">nData</span><span class="p">(</span><span class="nb">j</span><span class="p">)</span> <span class="p">=</span> <span class="n">n</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="k">end</span>
</span></span><span class="line"><span class="cl"> <span class="c">% The data is packaged into a cell array</span>
</span></span><span class="line"><span class="cl"> <span class="n">data</span> <span class="p">=</span> <span class="p">{</span><span class="n">VmData</span><span class="p">,</span><span class="n">mData</span><span class="p">,</span><span class="n">hData</span><span class="p">,</span><span class="n">nData</span><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c">% Values are reset to baseline at the end of the simulation</span>
</span></span><span class="line"><span class="cl"> <span class="n">Vm</span> <span class="p">=</span> <span class="n">conditions</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">m</span> <span class="p">=</span> <span class="n">conditions</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">h</span> <span class="p">=</span> <span class="n">conditions</span><span class="p">(</span><span class="mi">3</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">n</span> <span class="p">=</span> <span class="n">conditions</span><span class="p">(</span><span class="mi">4</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="k">end</span>
</span></span><span class="line"><span class="cl"><span class="k">end</span>
</span></span></code></pre></div><p>The default conditions listed above simulate the following neural activity.
<figure >
<div class="d-flex justify-content-center">
<div class="w-100" ><img alt="png" srcset="
/post/hodgkin-huxley/graph1_hu0d1c0adb2fd7226087d978a0ca7d4605_50686_5bc0ddfb6011f5cff3d7d78473099442.webp 400w,
/post/hodgkin-huxley/graph1_hu0d1c0adb2fd7226087d978a0ca7d4605_50686_e4c53898f6f174da5c95bf61a9b6c03a.webp 760w,
/post/hodgkin-huxley/graph1_hu0d1c0adb2fd7226087d978a0ca7d4605_50686_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://mmel099.github.io/post/hodgkin-huxley/graph1_hu0d1c0adb2fd7226087d978a0ca7d4605_50686_5bc0ddfb6011f5cff3d7d78473099442.webp"
width="760"
height="599"
loading="lazy" data-zoomable /></div>
</div></figure>
</p>
<p>By changing initial conditions and the pattern of applied current (Iapp), various firing patterns can be produced.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-matlab" data-lang="matlab"><span class="line"><span class="cl"><span class="n">tmax</span> <span class="p">=</span> <span class="mf">0.35</span><span class="p">;</span> <span class="c">% Duration of trial</span>
</span></span><span class="line"><span class="cl"><span class="n">delta</span> <span class="p">=</span> <span class="mf">0.00001</span><span class="p">;</span> <span class="c">% Step size</span>
</span></span><span class="line"><span class="cl"><span class="n">nSteps</span> <span class="p">=</span> <span class="n">int32</span><span class="p">((</span><span class="n">tmax</span><span class="p">)</span><span class="o">/</span><span class="n">delta</span><span class="p">);</span> <span class="c">% Number of steps in simulation</span>
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span> <span class="c">% Applied current throughout the trial</span>
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span><span class="p">(</span><span class="mf">0.1</span><span class="o">/</span><span class="n">delta</span><span class="p">:</span><span class="mf">0.2</span><span class="o">/</span><span class="n">delta</span><span class="p">)</span> <span class="p">=</span> <span class="mf">2.2</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">10</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="n">conditions</span> <span class="p">=</span> <span class="p">[</span><span class="n">El</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">0</span><span class="p">];</span> <span class="c">% [Vm m h n]</span>
</span></span></code></pre></div><p>
<figure >
<div class="d-flex justify-content-center">
<div class="w-100" ><img alt="png" srcset="
/post/hodgkin-huxley/graph2_hu317d66c4a3b554c3ecc916c1b9e6cc2d_61334_ce260292cfcd4ff42d6c3fd6fab97628.webp 400w,
/post/hodgkin-huxley/graph2_hu317d66c4a3b554c3ecc916c1b9e6cc2d_61334_d52f52b40a7f91b544dae776d795414b.webp 760w,
/post/hodgkin-huxley/graph2_hu317d66c4a3b554c3ecc916c1b9e6cc2d_61334_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://mmel099.github.io/post/hodgkin-huxley/graph2_hu317d66c4a3b554c3ecc916c1b9e6cc2d_61334_ce260292cfcd4ff42d6c3fd6fab97628.webp"
width="760"
height="600"
loading="lazy" data-zoomable /></div>
</div></figure>
</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-matlab" data-lang="matlab"><span class="line"><span class="cl"><span class="n">tmax</span> <span class="p">=</span> <span class="mf">0.35</span><span class="p">;</span> <span class="c">% Duration of trial</span>
</span></span><span class="line"><span class="cl"><span class="n">delta</span> <span class="p">=</span> <span class="mf">0.00001</span><span class="p">;</span> <span class="c">% Step size</span>
</span></span><span class="line"><span class="cl"><span class="n">nSteps</span> <span class="p">=</span> <span class="n">int32</span><span class="p">((</span><span class="n">tmax</span><span class="p">)</span><span class="o">/</span><span class="n">delta</span><span class="p">);</span> <span class="c">% Number of steps in simulation</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c">% The following several lines of code produce a unique Iapp</span>
</span></span><span class="line"><span class="cl"><span class="c">% pattern with 10 excitatory pulses</span>
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span> <span class="c">% Applied current throughout the trial</span>
</span></span><span class="line"><span class="cl"><span class="n">delay</span> <span class="p">=</span> <span class="mf">0.01</span><span class="p">;</span> <span class="c">% Delay variable that influences timing of current</span>
</span></span><span class="line"><span class="cl"><span class="n">IappPattern</span> <span class="p">=</span> <span class="p">[];</span>
</span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="nb">i</span><span class="p">=</span><span class="mi">1</span><span class="p">:</span><span class="mi">10</span>
</span></span><span class="line"><span class="cl"> <span class="n">temp1</span> <span class="p">=</span> <span class="nb">ones</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">int32</span><span class="p">(</span><span class="mf">0.005</span><span class="o">/</span><span class="n">delta</span><span class="p">))</span><span class="o">*</span><span class="mf">2.2</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">10</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">temp2</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">int32</span><span class="p">(</span><span class="n">delay</span><span class="o">/</span><span class="n">delta</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="n">IappPattern</span> <span class="p">=</span> <span class="nb">cat</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="n">IappPattern</span><span class="p">,</span><span class="n">temp1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">IappPattern</span> <span class="p">=</span> <span class="nb">cat</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="n">IappPattern</span><span class="p">,</span><span class="n">temp2</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="k">end</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span><span class="p">(</span><span class="n">int32</span><span class="p">(</span><span class="mf">0.1</span><span class="o">/</span><span class="n">delta</span><span class="p">):(</span><span class="n">int32</span><span class="p">(</span><span class="mf">0.1</span><span class="o">/</span><span class="n">delta</span><span class="p">)</span><span class="o">+</span><span class="nb">size</span><span class="p">(</span><span class="n">IappPattern</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span> <span class="p">=</span> <span class="n">IappPattern</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="n">conditions</span> <span class="p">=</span> <span class="p">[</span><span class="n">El</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">0</span><span class="p">];</span> <span class="c">% [Vm m h n]</span>
</span></span></code></pre></div><p>
<figure >
<div class="d-flex justify-content-center">
<div class="w-100" ><img alt="png" srcset="
/post/hodgkin-huxley/graph3_hu1884ff320a1c065effd77affb63d8c32_74502_d2b3b6c03e11999984d67d2a5a66d324.webp 400w,
/post/hodgkin-huxley/graph3_hu1884ff320a1c065effd77affb63d8c32_74502_1496899d64db0e5a39c8a629fab8b293.webp 760w,
/post/hodgkin-huxley/graph3_hu1884ff320a1c065effd77affb63d8c32_74502_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://mmel099.github.io/post/hodgkin-huxley/graph3_hu1884ff320a1c065effd77affb63d8c32_74502_d2b3b6c03e11999984d67d2a5a66d324.webp"
width="760"
height="603"
loading="lazy" data-zoomable /></div>
</div></figure>
</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-matlab" data-lang="matlab"><span class="line"><span class="cl"><span class="n">tmax</span> <span class="p">=</span> <span class="mf">0.35</span><span class="p">;</span> <span class="c">% Duration of trial</span>
</span></span><span class="line"><span class="cl"><span class="n">delta</span> <span class="p">=</span> <span class="mf">0.00001</span><span class="p">;</span> <span class="c">% Step size</span>
</span></span><span class="line"><span class="cl"><span class="n">nSteps</span> <span class="p">=</span> <span class="n">int32</span><span class="p">((</span><span class="n">tmax</span><span class="p">)</span><span class="o">/</span><span class="n">delta</span><span class="p">);</span> <span class="c">% Number of steps in simulation</span>
</span></span><span class="line"><span class="cl"><span class="n">delay</span> <span class="p">=</span> <span class="mf">0.020</span><span class="p">;</span> <span class="c">% Delay is set to 20ms</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c">% The following several lines of code produce a unique Iapp</span>
</span></span><span class="line"><span class="cl"><span class="c">% pattern with 10 inhibitory pulses</span>
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span> <span class="p">=</span> <span class="nb">ones</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="mf">6.0</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">10</span><span class="p">;</span> <span class="c">% Applied current throughout the trial</span>
</span></span><span class="line"><span class="cl"><span class="n">IappPattern</span> <span class="p">=</span> <span class="p">[];</span>
</span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="nb">i</span><span class="p">=</span><span class="mi">1</span><span class="p">:</span><span class="mi">10</span>
</span></span><span class="line"><span class="cl"> <span class="n">temp1</span> <span class="p">=</span> <span class="nb">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">int32</span><span class="p">(</span><span class="mf">0.005</span><span class="o">/</span><span class="n">delta</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"> <span class="n">temp2</span> <span class="p">=</span> <span class="nb">ones</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">int32</span><span class="p">(</span><span class="n">delay</span><span class="o">/</span><span class="n">delta</span><span class="p">))</span><span class="o">*</span><span class="mf">6.0</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">10</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"> <span class="n">IappPattern</span> <span class="p">=</span> <span class="nb">cat</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="n">IappPattern</span><span class="p">,</span><span class="n">temp1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">IappPattern</span> <span class="p">=</span> <span class="nb">cat</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="n">IappPattern</span><span class="p">,</span><span class="n">temp2</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="k">end</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span><span class="p">(</span><span class="mf">0.1</span><span class="o">/</span><span class="n">delta</span><span class="p">:((</span><span class="mf">0.1</span><span class="o">/</span><span class="n">delta</span><span class="p">)</span><span class="o">+</span><span class="nb">size</span><span class="p">(</span><span class="n">IappPattern</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span> <span class="p">=</span> <span class="n">IappPattern</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="n">conditions</span> <span class="p">=</span> <span class="p">[</span><span class="o">-</span><span class="mf">0.065</span> <span class="mf">0.05</span> <span class="mf">0.5</span> <span class="mf">0.35</span><span class="p">];</span> <span class="c">% [Vm m h n]</span>
</span></span></code></pre></div><p>
<figure >
<div class="d-flex justify-content-center">
<div class="w-100" ><img alt="png" srcset="
/post/hodgkin-huxley/graph4_hubc20e56cc12c730f4756fcd4066cc7da_70104_f23c93bf820efc4093a884e3292f9b1b.webp 400w,
/post/hodgkin-huxley/graph4_hubc20e56cc12c730f4756fcd4066cc7da_70104_d5d339410e449d9645db68f49196d636.webp 760w,
/post/hodgkin-huxley/graph4_hubc20e56cc12c730f4756fcd4066cc7da_70104_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://mmel099.github.io/post/hodgkin-huxley/graph4_hubc20e56cc12c730f4756fcd4066cc7da_70104_f23c93bf820efc4093a884e3292f9b1b.webp"
width="760"
height="593"
loading="lazy" data-zoomable /></div>
</div></figure>
</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-matlab" data-lang="matlab"><span class="line"><span class="cl"><span class="n">tmax</span> <span class="p">=</span> <span class="mf">0.35</span><span class="p">;</span> <span class="c">% Duration of trial</span>
</span></span><span class="line"><span class="cl"><span class="n">delta</span> <span class="p">=</span> <span class="mf">0.00001</span><span class="p">;</span> <span class="c">% Step size</span>
</span></span><span class="line"><span class="cl"><span class="n">nSteps</span> <span class="p">=</span> <span class="n">int32</span><span class="p">((</span><span class="n">tmax</span><span class="p">)</span><span class="o">/</span><span class="n">delta</span><span class="p">);</span> <span class="c">% Number of steps in simulation</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span> <span class="p">=</span> <span class="nb">ones</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="mf">6.5</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">10</span><span class="p">;</span> <span class="c">% Applied current throughout the trial</span>
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span><span class="p">(</span><span class="n">int32</span><span class="p">(</span><span class="mf">0.1</span><span class="o">/</span><span class="n">delta</span><span class="p">):</span><span class="n">int32</span><span class="p">(</span><span class="mf">0.105</span><span class="o">/</span><span class="n">delta</span><span class="p">))</span> <span class="p">=</span> <span class="mi">10</span>^<span class="o">-</span><span class="mi">9</span><span class="p">;</span> <span class="c">% One excitatory pulse</span>
</span></span><span class="line"><span class="cl"><span class="n">conditions</span> <span class="p">=</span> <span class="p">[</span><span class="o">-</span><span class="mf">0.065</span> <span class="mf">0.05</span> <span class="mf">0.5</span> <span class="mf">0.35</span><span class="p">];</span> <span class="c">% [Vm m h n]</span>
</span></span></code></pre></div><p>
<figure >
<div class="d-flex justify-content-center">
<div class="w-100" ><img alt="png" srcset="
/post/hodgkin-huxley/graph5_huc3b8fba15668f4cad25df173f5b6073b_64120_08c1ce1d760db00860d18f51c3bc1646.webp 400w,
/post/hodgkin-huxley/graph5_huc3b8fba15668f4cad25df173f5b6073b_64120_1ed4d70ca1e535be860041f50377c3e1.webp 760w,
/post/hodgkin-huxley/graph5_huc3b8fba15668f4cad25df173f5b6073b_64120_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://mmel099.github.io/post/hodgkin-huxley/graph5_huc3b8fba15668f4cad25df173f5b6073b_64120_08c1ce1d760db00860d18f51c3bc1646.webp"
width="760"
height="604"
loading="lazy" data-zoomable /></div>
</div></figure>
</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-matlab" data-lang="matlab"><span class="line"><span class="cl"><span class="n">tmax</span> <span class="p">=</span> <span class="mf">0.35</span><span class="p">;</span> <span class="c">% Duration of trial</span>
</span></span><span class="line"><span class="cl"><span class="n">delta</span> <span class="p">=</span> <span class="mf">0.00001</span><span class="p">;</span> <span class="c">% Step size</span>
</span></span><span class="line"><span class="cl"><span class="n">nSteps</span> <span class="p">=</span> <span class="n">int32</span><span class="p">((</span><span class="n">tmax</span><span class="p">)</span><span class="o">/</span><span class="n">delta</span><span class="p">);</span> <span class="c">% Number of steps in simulation</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span> <span class="p">=</span> <span class="nb">ones</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">nSteps</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="mf">7.0</span><span class="o">*</span><span class="mi">10</span>^<span class="o">-</span><span class="mi">10</span><span class="p">;</span> <span class="c">% Applied current throughout the trial</span>
</span></span><span class="line"><span class="cl"><span class="n">Iapp</span><span class="p">(</span><span class="n">int32</span><span class="p">(</span><span class="mf">0.1</span><span class="o">/</span><span class="n">delta</span><span class="p">):</span><span class="n">int32</span><span class="p">(</span><span class="mf">0.105</span><span class="o">/</span><span class="n">delta</span><span class="p">))</span> <span class="p">=</span> <span class="mi">10</span>^<span class="o">-</span><span class="mi">9</span><span class="p">;</span> <span class="c">% One excitatory pulse</span>
</span></span><span class="line"><span class="cl"><span class="n">conditions</span> <span class="p">=</span> <span class="p">[</span><span class="o">-</span><span class="mf">0.065</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">0</span><span class="p">];</span>
</span></span></code></pre></div><p>
<figure >
<div class="d-flex justify-content-center">
<div class="w-100" ><img alt="png" srcset="
/post/hodgkin-huxley/graph6_hu9f755cd906c4998b8cb3d3c5ef74edad_74002_ef19312c2a6f7d6e29418bfe818e11d4.webp 400w,
/post/hodgkin-huxley/graph6_hu9f755cd906c4998b8cb3d3c5ef74edad_74002_2a0d3e8d29de44df4e6bfb20e035304b.webp 760w,
/post/hodgkin-huxley/graph6_hu9f755cd906c4998b8cb3d3c5ef74edad_74002_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://mmel099.github.io/post/hodgkin-huxley/graph6_hu9f755cd906c4998b8cb3d3c5ef74edad_74002_ef19312c2a6f7d6e29418bfe818e11d4.webp"
width="760"
height="614"
loading="lazy" data-zoomable /></div>
</div></figure>
</p>
<h3 id="impact-on-neuroscience">Impact on Neuroscience:</h3>
<p>The Hodgkin-Huxley model has had a profound impact on neuroscience and computational neuroscience in particular. It serves as a cornerstone for studying neuronal excitability, guiding research in diverse areas such as synaptic transmission, neural networks, and neuropharmacology.</p>
<h3 id="challenges-and-extensions">Challenges and Extensions:</h3>
<p>While the Hodgkin-Huxley model provides a robust foundation, it is not without limitations. Simplifications and assumptions made in the model&rsquo;s development open avenues for deviations from neural activity in the real world. Modern computational models often build upon Hodgkin-Huxley principles, incorporating additional features that attempt to more closely replicate neural morphology and behavior.</p>
</description>
</item>
<item>
<title>K-Means Algorithm</title>
<link>https://mmel099.github.io/post/kmeans/</link>
<pubDate>Tue, 02 Jan 2024 00:00:00 +0000</pubDate>
<guid>https://mmel099.github.io/post/kmeans/</guid>
<description><p>Clustering is a fundamental concept in machine learning, and one of the go-to algorithms for partitioning data into distinct groups is the K-Means algorithm.</p>
<h3 id="understanding-the-basics">Understanding the Basics:</h3>
<p>K-Means is a centroid-based clustering algorithm designed to partition a dataset into K clusters. The &ldquo;K&rdquo; in K-Means represents the predetermined number of clusters the algorithm aims to identify. It&rsquo;s an unsupervised learning method, meaning it does not require labeled training data to function.</p>
<h3 id="how-it-works">How It Works:</h3>
<p>Initialization:
K-Means begins by selecting K initial centroids, one for each cluster. These centroids can be randomly chosen data points or strategically placed based on some prior knowledge.</p>
<p>Assigning Data Points to Clusters:
Each data point is assigned to the cluster whose centroid is closest to it. Proximity is typically measured using Euclidean distance, but other distance metrics can be employed based on the nature of the data.</p>
<p>Updating Centroids:
After the initial assignments, the centroids are recalculated by taking the mean of all the data points within each cluster. This step iterates until the centroids no longer change significantly or a predetermined number of iterations is reached.</p>
<p>Convergence:
The algorithm converges when the centroids stabilize, and the assignments remain unchanged between iterations.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># This is a K-Means algorithm implemented from scratch</span>
</span></span><span class="line"><span class="cl"><span class="c1"># It initializes k random centroids and assigns points to clusters using euclidean distance </span>
</span></span><span class="line"><span class="cl"><span class="c1"># With each iteration, centroids are recaluclated based on the mean of data points assigned to that cluster</span>
</span></span><span class="line"><span class="cl"><span class="c1"># If a smaller euclidean distance to another centroid is identified, the data point is reassigned to the other cluster</span>
</span></span><span class="line"><span class="cl"><span class="c1"># The algorithm will converge when centroids become statatic or after 100 iterations, whichever happens first</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Arguments: k is predetermined number of clusters; X is input data</span>
</span></span><span class="line"><span class="cl"><span class="c1"># Returns: centroids are values of cluster centersl labels are cluster assignments for each data point</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">KMeansFromScratch</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">X</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="n">centroids</span> <span class="o">=</span> <span class="n">X</span><span class="p">[</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">choice</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="n">X</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="n">k</span><span class="p">,</span> <span class="n">replace</span><span class="o">=</span><span class="kc">False</span><span class="p">)]</span>
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">100</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="n">prev_centroids</span> <span class="o">=</span> <span class="n">centroids</span>
</span></span><span class="line"><span class="cl"> <span class="n">distances</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">concatenate</span><span class="p">([</span><span class="n">np</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">X</span> <span class="o">-</span> <span class="n">centroid</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="k">for</span> <span class="n">centroid</span> <span class="ow">in</span> <span class="n">centroids</span><span class="p">],</span><span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">labels</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">argmin</span><span class="p">(</span><span class="n">distances</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">centroids</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">concatenate</span><span class="p">([</span><span class="n">X</span><span class="p">,</span> <span class="n">labels</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)],</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">groupby</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">mean</span><span class="p">()</span><span class="o">.</span><span class="n">values</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">np</span><span class="o">.</span><span class="n">array_equal</span><span class="p">(</span><span class="n">centroids</span><span class="p">,</span> <span class="n">prev_centroids</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">centroids</span><span class="p">,</span> <span class="n">labels</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">centroids</span><span class="p">,</span> <span class="n">labels</span>
</span></span></code></pre></div><p>
<figure >
<div class="d-flex justify-content-center">
<div class="w-100" ><img alt="gif"
src="https://mmel099.github.io/post/kmeans/convergence.gif"
loading="lazy" data-zoomable /></div>
</div></figure>
<em><a href="https://en.m.wikipedia.org/wiki/File:K-means_convergence.gif" target="_blank" rel="noopener">Wikipedia Author: Chire</a></em></p>
<h3 id="applications-of-k-means">Applications of K-Means:</h3>
<p><em>Image Compression:</em>
K-Means can be used to reduce the number of colors in an image, effectively compressing it while preserving its essential features.</p>
<p><em>Customer Segmentation:</em>
Businesses utilize K-Means to categorize customers based on purchasing behavior, allowing for targeted marketing strategies.</p>
<p><em>Anomaly Detection:</em>
K-Means can identify outliers or anomalies in datasets by grouping normal data points into clusters and isolating those that deviate.</p>
<p><em>Genetic Clustering:</em>
In biological research, K-Means helps classify genes with similar expression patterns, aiding in the identification of gene functions.</p>
<h3 id="challenges-and-considerations">Challenges and Considerations:</h3>
<p><em>Sensitivity to Centroid Initialization:</em>
K-Means results can vary based on the initial placement of centroids, and multiple runs with different initializations may be needed to find the optimal solution.</p>
<p><em>Assumption of Spherical Clusters:</em>
The algorithm assumes that clusters are spherical and equally sized, which may not be suitable for all types of data.</p>
<p><em>Possibility of Empty Clusters:</em>
As the algorithm iterates to convergence, there is a chance that all data points get reassigned from a cluster, leaving it empty. A common solution is to choose a random point to act as a new centroid if any empty clusters are detected.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># This is a comprehensive K-Means Algorithm using the sklearn package</span>
</span></span><span class="line"><span class="cl"><span class="c1"># Outliers are identified using isolation forest and removed</span>
</span></span><span class="line"><span class="cl"><span class="c1"># Model fit is evaluated using normalized mutual information by comparing predicted labels to ground truth labels</span>
</span></span><span class="line"><span class="cl"><span class="c1"># Ten runs of K-Means are completed and the model with the highest NMI score is selected</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Arguments: k is predetermined number of clusters; X is input data; true_labels are ground truth labels</span>
</span></span><span class="line"><span class="cl"><span class="c1"># Returns: final_centroids are values of cluster centers; final_labels are cluster assignments for each data point</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">sklearn.cluster</span> <span class="kn">import</span> <span class="n">KMeans</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">sklearn.ensemble</span> <span class="kn">import</span> <span class="n">IsolationForest</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">sklearn.metrics</span> <span class="kn">import</span> <span class="n">normalized_mutual_info_score</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">ComprehensiveKMeans</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">X</span><span class="p">,</span> <span class="n">true_labels</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">isolation_forest</span> <span class="o">=</span> <span class="n">IsolationForest</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="n">isolation_forest</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">outliers</span> <span class="o">=</span> <span class="n">isolation_forest</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">X</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">X</span> <span class="o">=</span> <span class="n">X</span><span class="p">[</span><span class="n">outliers</span> <span class="o">==</span> <span class="mi">1</span><span class="p">]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">kmeans</span> <span class="o">=</span> <span class="n">KMeans</span><span class="p">(</span><span class="n">n_clusters</span><span class="o">=</span><span class="n">k</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">best_score</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
</span></span><span class="line"><span class="cl"> <span class="n">best_model</span> <span class="o">=</span> <span class="kc">None</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="n">kmeans</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">labels</span> <span class="o">=</span> <span class="n">kmeans</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">X</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">score</span> <span class="o">=</span> <span class="n">normalized_mutual_info_score</span><span class="p">(</span><span class="n">labels</span><span class="p">,</span> <span class="n">true_labels</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">score</span> <span class="o">&gt;</span> <span class="n">best_score</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">best_score</span> <span class="o">=</span> <span class="n">score</span>
</span></span><span class="line"><span class="cl"> <span class="n">best_model</span> <span class="o">=</span> <span class="n">kmeans</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">final_labels</span> <span class="o">=</span> <span class="n">best_model</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">X</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">final_centroids</span> <span class="o">=</span> <span class="n">best_model</span><span class="o">.</span><span class="n">cluster_centers_</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">final_centroids</span><span class="p">,</span> <span class="n">final_labels</span>
</span></span></code></pre></div></description>
</item>
<item>
<title>Pathos: Associations of Word Usage and Emotions</title>
<link>https://mmel099.github.io/project/pathos/</link>
<pubDate>Tue, 19 Dec 2023 00:00:00 +0000</pubDate>
<guid>https://mmel099.github.io/project/pathos/</guid>
<description><h2 id="abstract">Abstract</h2>
<p>In the realm of psychology and neuroscience, understanding human experiences and emotions through word usage can present a fascinating and difficult challenge. Words choice can be highly person and context-dependent. However, with a large enough sample of written answers to a single question prompt, we may be able to identify certain trends in word usage.</p>
<p>In this project, I used a dataset (X. Alice Li and Devi Parikh, 2019) that contains a large number (N = 1473) of written responses to the question: “What were salient aspects of your day yesterday? How did you feel about them?”. Additionally, each response is labelled with one or more emotion from an exhaustive list of 18 different emotions.</p>
<p>In my analysis, I attempted to find associations between frequent words that participants included in their responses and the emotions these responses were labelled with. Next, I explored word co-occurence and the associations of word pairs to emotions. Certain trends in word usage and emotional labels were identified throughout the analysis, however, an issue with the sample size was also noted.</p>
</description>
</item>
<item>
<title>Sweet Dreams: A Regression Analysis of Macronutrient Intake and Sleep Quality</title>
<link>https://mmel099.github.io/project/sweet-dreams/</link>
<pubDate>Sun, 10 Dec 2023 00:00:00 +0000</pubDate>
<guid>https://mmel099.github.io/project/sweet-dreams/</guid>
<description><h2 id="abstract">Abstract</h2>
<p>Sleep quality is a critical component of overall well-being, with numerous factors affecting its duration and depth. Among these factors, nutrition plays a pivotal yet underexplored role in regulating sleep quality. Accurately measuring an individual’s dietary intake is a fundamental challenge in nutritional research. The National Health and Nutrition Examination Survey (NHANES) is an annual survey conducted by the Centers for Disease Control and Prevention (CDC) that collects various health-related data and weights it to be nationally representative.</p>
<p>This project takes advantage of the large sample size of the NHANES dataset to draw associations between macronutrient predictors and sleep quality outcomes. Moreover, the demographic data collected through NHANES others us a way to investigate relevant confounders that are associated with both nutrition and sleep. We identified three final outcome variables related to sleep quality. One outcome was the duration of sleep, rounded to the closest half-hour, on weekdays; this outcome was modeled using multiple linear regression. Another relevant outcome was an indicator for whether the participant had ever told a doctor about trouble sleeping; this was modeled using multinomial regression. The final outcome was a categorical variable asking how often a participant felt overly sleepy during the past month. Furthermore, we aggregated our three sleep outcomes into a single overall metric of sleep quality and fit a Quasi-Poisson regression model.</p>
<p>Fiber intake was found to be positively associated with sleep quality, across linear, multinomial, and Quasi-Poisson regressions. Protein was found to have a negative association with length and quality of sleep across the Quasi-Poisson and linear models. Carbohydrates were found to have a harmful effect on sleep quality in the adjusted multinomial models.</p>
</description>
</item>
<item>
<title>Principal Component Analysis</title>
<link>https://mmel099.github.io/talk/principal-component-analysis/</link>
<pubDate>Fri, 09 Dec 2022 12:00:00 +0000</pubDate>
<guid>https://mmel099.github.io/talk/principal-component-analysis/</guid>
<description><p>I created a video for my final presentation for a course in linear algebra at Brandeis University. The assignment required a tutorial video on a topic related to something covered in class. My presentation outlined the principal component analysis (PCA) method and its relationship to eigenvectors and eigenvalues.</p>
<video controls >
<source src="https://mmel099.github.io/talk/principal-component-analysis/pca.mp4" type="video/mp4">
</video>
</description>
</item>
<item>
<title>Hello R Markdown</title>
<link>https://mmel099.github.io/post/2020-12-01-r-rmarkdown/</link>
<pubDate>Tue, 01 Dec 2020 21:13:14 -0500</pubDate>
<guid>https://mmel099.github.io/post/2020-12-01-r-rmarkdown/</guid>
<description>
<div id="r-markdown" class="section level1">
<h1>R Markdown</h1>
<p>This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <a href="http://rmarkdown.rstudio.com" class="uri">http://rmarkdown.rstudio.com</a>.</p>
<p>You can embed an R code chunk like this:</p>
<pre class="r"><code>summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
fit &lt;- lm(dist ~ speed, data = cars)
fit
##
## Call:
## lm(formula = dist ~ speed, data = cars)
##
## Coefficients:
## (Intercept) speed
## -17.579 3.932</code></pre>
</div>
<div id="including-plots" class="section level1">
<h1>Including Plots</h1>
<p>You can also embed plots. See Figure <a href="#fig:pie">1</a> for example:</p>
<pre class="r"><code>par(mar = c(0, 1, 0, 1))
pie(
c(280, 60, 20),
c(&#39;Sky&#39;, &#39;Sunny side of pyramid&#39;, &#39;Shady side of pyramid&#39;),
col = c(&#39;#0292D8&#39;, &#39;#F7EA39&#39;, &#39;#C4B632&#39;),
init.angle = -50, border = NA
)</code></pre>
<div class="figure"><span style="display:block;" id="fig:pie"></span>
<img src="https://mmel099.github.io/post/2020-12-01-r-rmarkdown/index.en_files/figure-html/pie-1.png" alt="A fancy pie chart." width="672" />
<p class="caption">
Figure 1: A fancy pie chart.
</p>
</div>
</div>
</description>
</item>
</channel>
</rss>