-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
636 lines (310 loc) · 171 KB
/
atom.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
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Ⅹ. Harbor</title>
<icon>https://www.gravatar.com/avatar/ab3d855fe5c65deed5c8f765972aac7c</icon>
<link href="https://discover304.top/atom.xml" rel="self"/>
<link href="https://discover304.top/"/>
<updated>2024-10-03T17:29:13.703Z</updated>
<id>https://discover304.top/</id>
<author>
<name>✨白拾ShiroX✨</name>
<email>[email protected]</email>
</author>
<generator uri="https://hexo.io/">Hexo</generator>
<entry>
<title>UIST2023 Generative Agents: Interactive Simulacra of Human Behavior</title>
<link href="https://discover304.top/2024/10/03/2024q4/196-generative-agent/"/>
<id>https://discover304.top/2024/10/03/2024q4/196-generative-agent/</id>
<published>2024-10-03T11:41:51.000Z</published>
<updated>2024-10-03T17:29:13.703Z</updated>
<content type="html"><![CDATA[<div class="hbe hbe-container" id="hexo-blog-encrypt" data-wpm="密码错误,请重试。" data-whm="抱歉, 这个文章不能被校验, 不过您还是能看看解密后的内容."> <script id="hbeData" type="hbeData" data-hmacdigest="2ab1e252334174a4b823ae28bddd6f4311bbcb5701b0eba97ad3ed686add08eb">d6b2705594faac2605c03c803e14c0008c69250ea2786399748dbac0b44e1aac75aa8c34f829bfa1c824c2d45765eac04e47766b0c7220ba480e769479c7aeea6440ba5a8a9f9b48a83b028bd1ed1c9ea5210c2d6a3a56d11e0a119e7fed7e6701a474efc8ed1a773fceb40b7a9a713a3e71c26f56ceee068926f7a28aa9bfa71f362edeebc232b4f6c2e51d4bfa4cb8594622284f0030f08eee26e2b35e6b074747d3675f94ddb2f514b8550ac3fad87fa428be9b5f13597885ba66ee1f53ff647bac80f928711911128b23088eaa258a41af86043b6cc5eddf15d84f5470302cb6900f0213afd632e93ff8e4258816ade979292d101d2349f36d8939f8f58b077b9e5323aa91511ba689feb4b2d942b73188f09b49fc52aca010a9445d6f2cd3473ab7ab93fe5cf8afd9506545966e2115b8b292b2b59bae5378626f0668b5335bd9300dee19080320ebecff575f53ac308a928242fb67a628ffba2313a01f2643012d36f5b2ff37cb4f728f8d04f003d73249ebec7c4caeeba847c476cf6ca493df33dcbfde2cf5f2bd40baf69efdedd20dfc5e453ff2b5d0f2100e5c77a42b00a63df4f407172aca4bb0eedb532856e5fc9abebb197aa89154f1452109c374ffa47e2139c97f66196b6c4212472b2bb171ffcba53e0e9db3477c4a6a4f8dc095573699fc33cd0461979c64680cc6435dcb529682c29afb987f51fb6cd537c36f6d021e3875404f6a83ebf989963543428f6a6b0eae5ef0131ee20c6ba231b16875f805b7ecc743c16abd0e4bcca781874c85a2b085e699ed1cf6fa9181ff3542078698002b16b43687abbc3d89d7218c505ac11efa303e80e4dc3c14302183512251663938b6a7c387253c8c16251b57926202c58a9c6aa1a5f71b372598be5319a680c9c291ab52d1581f9aa9bc6b7cf64f679f60f57c51842e9906bc86c35a5d2dc48cd706ba29846c19e6d14301659fa416d3475324a552ce13fcb47fd0229a0db9ec6015a2129868083b2850132e2965cb6c52f497e76cb848c718e41089466b0c9832a7bec19fb592d986dc14e50d86b722df0c34553b073852d0ea77d8320f8bcd55c13467bd7bc9863e9d5ce8c419508f1bdeb0f6cd5f9b1e29c95733ad4fd9af7cb734ea3dcc9445f6acb2bf84acd84d66d2b216a880c53fb14ea9259ee8c730d4ae5108a66ed07f2d12decdf9b5f3f7123f970adc6964a6e95b91b2ea2e5b8785ac826bd76d6e72df05e8424cb2c8e122a3471602cee263c5890002aa4fe4e2f87ca78d9758fa213c2d13d4b74b149993254264fb47eb6741e0510352b40ef400ca3b45c120ff2b685f5f5b90c276092d2c19bcd9792d68c40a551a724cc96336cc68bd9dff3686c5379a57c901a12245bb0308e5d2ab19a981975c5f8c025d339bb4e54170d908d8833e6df509f65588bd1b98f14e024ce8fde263a52b4fe9a7de21491fcd6951c41aae84fc3a0aebd2662ba484f6f79efb75e5d4ee6d0b426a54aed9350409dcf65a8a0fc51077f4df85246427adeb9c26a3c30abd45824cc3b50077ef2783689a576e6396065e056c3a8e7aa0220ebbdb665124175f0cffd31708800e722104f4584a340a7b3628b746afa1dc93adb65612d5f8dc4fd45ed397dbe96e02fc3eee81662c5825eade87bd2ab72e456fc86f484a1e46e4d106ccef1da05f993da555d9878e1146bcf147cd1a5acddb724b9d3c8da0e675125fe69c4b582e7e4698387f6edfb1053144558fb1dd8c5ce4812ddf2e38f1961eabdda786fba155b21a3474559d26b919f4c6472aa76a4d0e1016709f626f2ba1c7ed7640a12266345dd2aded539525d3efef9d149361dae1b86709b5e3a81557052d6222ac993cbdefb419ddbe0c0afd55329c346c777204847f60573effb2e7914c261b0d133c85d9781d4f8ed6df9b3e803508ed8148acc950484864cbefa568814d7bbbb0d44b3396626d82fea9766c290be367a1dc640f0361a82c68f8886b354ec1fbad956e5e74395960eef5722741502eff3586f09756bbb3f8f2fbcb04b25c51bf09378afa0dfbbe81d7c5720bcf8f8aeb8b3d4f00044cc37ccd261e4f703869dec73d42ad7a1ce9912fdd64b031d838bee68d1596d50ef816d0c729e9dbc5b1ddf861aa8ba0428faff0ace675c3de4a662e0f31ed1fc42aa646c26946e3b21f5a110d945126698354a0f3756c7551baf2a8e076ec082c1cd5f7576916f898f4ffc20e1b5d84e772bdeb5fd5a55765d5c6a543c540a2b977b3bf2d9a71f1dae7c31b74eb31c22844afa44e431e01db33cc67df4f48f6984dd5e1e79ce82ab6736c7e8f1135c08db21ffa0568c2fe47cf28449151ae53e5088cd9a12a95ddde6aae67e39a1608d7367e322aee7c84fcbdef17c1a55d86f43fe846e2955f17724899029d9ebc226a9c7026e4b8569b979e58f4458209259a84185196c12963ae997ba589b665070afc167721b90759031e24d62e6ac26a9ce038f0d49872e05d7716addb3a46d4ad2a39bd83dd98522258320cbdfde80c84b3754fc0c5a52cfd458c4a12d62af212e1a85977d2ffa31309f1f5a15a8bbbd424f2205bc6b662c2e9a969c6225e237a998fd6b9f4b512cadfe4a16a65452a328998e8286aa74f77196bf2139db83a9aaffe6c482c82581b7293c21f44ee562f5c5c157f9e7a9b7fc8dbf3d7ec2a50e3fe33c169a7fbc1063d9a0209d043b433a42505e20ba6d9ca991d0550728b28e50ef32f315764aea7c113be199faa771ee316482db190315a9e467d269762c949bce401695eddf7bc9bf56a4a676ddfe5eb209dd795d85fef8a718a274107ab5bc6f61cdba74c6b16c59a680ba20cdd71dbfa687388f338bab650dc3324c1af044439128fcf6ca301c6c5acbe24c2e5f8aafd853087d7e127b7238371a31faaa40c706ac86d5d02fc9fae12e17ff2eeedd8cd6e49cd9d622fa7ae0548aee747a8114be7f751aea64fcf98a85f17c444f28af82167edc7b15d8cd3dbbf5affbdfe9d1c9d645bed76c33d1779bc67305782f29ad8514fd5eb665688e6b527d8dd77859103af8f122ce10664e55793e723c9f57a4b466b76a10c9de08638f1df4ed8d8eb40eb2a843bf033e3b5b9584c86726c6b456e3c0bca0ee192196b0828159aa8d89bca0f12ca8d7bda6e50c92e02b6c0e1da249d2168dc6465367950247cb9a5ae2f5223bb5dd0b800153a88d22d2fa6fd92200ae70880aef4a10532d5d04a11d17053e0de951c89523d7e3774e8158ce0f3ec71d35fc949724c5dd210ac4d68038f1f85f27f086d14865049c06422f828ceb77e4e041f43a6d481ccb90e5fc0dc3e4bf3253bbcad2962feaeb3e0e398560067d7a07427fb439c768d40895d2d4c8bbca2cd632168e41691db2118c91e3f74161bd48414f6fdc8259587fa9ea2016326efbc137ccfba5380bd42c713bd626a5677fe03368b873ea09b01335329f1fb851b89467736ff6c23e41c4ecc5ab5f3eb76344457b548b4c23c7ba94ab247f5417957fc61eb4d20018c3639f0d7b2b09b8c3aac89d7937403011fb0ae4287619b4b076aeddc4fc5ba8577ce71d326674637de958c73116a46d7e9c0742b3ecd26ce5eb4ca4b8d26514e87f8a1e18a0016d8287e1626c3a15b2f1a1329239a9977adbcb3fda28757a0de2ae80d71ffab34bbf679aa3eda906f8d6ae5a085f78af9db5f06ab2f8629fdba7cf813dcd48bf11514d84a25ce6e7fb6445a5599d08973fe1af3f8691573511c452fb95a6c5a423b8914c6e034ae4d4b50fd4607a6853c689b9dced06a2ade0d973c4f7c8cd9c4374050faec9c95dc9c53c07ff057945e93d6a693659f92d3eadb4e9b6a80f464246c765d02c4542803b2a3daafdfdb3b510224d293689427e6382e17826bfebbf76ef5b6309730b7c56307fe1963c10b28cab7348f2228fb0af685f31c9c9d24041d99257dcf04c7c9270eeb6119b91e48df014a1078040ccb43975eb7bc3f1c1f98e281e9807d6ed17192fa6368505be8e0dd9f0773bd3f4a3a5adc9120f9939e966fd8e85423b5951d1cccd18eb4f4a29017e77a1faa0384aee95887443586ff7abbef9f540c3ff3b7f1363b1c391858a68c1cde52b5cc65e721a2c848eefcfac57206d6ed73869a660def7faf84e4a85656b2f4ae07fbb1490e024549bb759aa66bf2e1e845ae01e941a696e6f17c119aabbed0b1bff2b7213987967a6f12e47d3de440a1fdff2f9d9484a3cd41983a0161298b1a1694fd93b22fc7b6279e18e46a6da6aea9630da613c2fef0db3fbf7c2a7b469fb0d6c5e3fa6063bec15bab8fe8c48b65c4d4b9265dfa4b56381e2252473c780c9b484ae18ff890c84694f1612c338fbbf6871226c0686315313caa4ca16ce40e0d9b76310df8ded4a717e45622bc4e07b12ae45e94f691a26a86baf7cc8f35cbafcc7b50c41e738063597d4caa64a9fb082ddd9240cfb8e5e56cef47f12d9584ddc65d1bf2615b5fbc697645088e8086feac4cf89cbff651ea568786a6ed8e4d7d14952ad4946506f33c9c1871eeb7f936a1ccd777a13724ab3c77649985161a4174f2f880483f807e5925f2508d3bfa58cd06123593d3ab081eca6519b3ee823470c47c115c9bf3188b195480df937d99e3039144248fc54f055734f15b66abea80aa5e6d53e94b6c6383a495dc3aea7fed161780a646b1195349ea26620238692684b44dfbea2d36e7eddb2b49dc2c546d239729445d8b218b04e852063e0547d9b8f93918a39fd16878dbc060248b7e2093afaadf11b471b03d02a8e5071a510dcb627659dbe79c7cf53770d71a769244a99bc873a073e35e2347cd21d43529c9a915e2f52dc2c3f6e39a921c5221cd4e01a2aa2daf5be1111a167df542185d6cc024e528009092fe6737b2f613842429778bd9cd755abfa549827d97e6f5d083a271fb5bd90d1572d927c52cd64bcf9cce9b6349aabb0f4fc0f59f9c22aefd8272e58d6b246d1fbba21fe0504c600917041a70180de4fa7193824bc4735a1dbd765b9affeb52b07e80fbd5544777cf3a513594441478247f8c9d57702d251a50e3daef23bf3c7846388ec632584a05fe431994620d40906f8f4d1ddf3236e628338e6ddc9cba0614866d510a1c0289426aabb6ade558552f9963de5a809130219635481246c7c06925944059091360d372fbc2645060335631a7f2eb775febed66a4facfb027b1b7b75cae6074bfbc36a9f885a62ae5ce417f688f94f3052d59cbbf8a697c863536175fd2e0af489712161e2dbb7d3cbee51fa04cdfd9f2d2d0b54b9ce5ac0c906ae4bf4febc7a28f6c15e4ea665553c4fa1d201cc2e4bd942dfebf8c831478b9af200590dfc368e33df5ff5e29403f0ecb3a83e7197056f054cd85ab75075710c941b7658291b07bc33156f3156f622e00688e4c84bc2672841e80ab74940d4b645077dad5f3efa6a8a568f5e5f2eba3c776964b5012a8399442e7ab77e53f035bf018cb3178ec2cd08738b37cf8be9340f3a4afa72f44f5c025dc2286fe48e155d062932228dd9d5fdc032f09f1b70c8e73ed17b9411951cbd12dfab971e745db39a4e0d2e3190aac4b4302d97a64fafa1c29f6025db012deb2448af1c4dcaed065386d50936e50666db7f652b6f39ac91cb08622e4ca760a8196afce1641d2a3775b36c38846bf290cce0c8941be937b2d76f7f3a258759d74a5c9cf4e8d12d94f2673079e6e32db94cf911378d4617b21e860ec7845cebefd98a2aefd72cdf850030f97cbf1f81193a400a5d23d9d2759a4cc930eaeb3326b9df830cce1437428e309f67faea1b8d77dd5d0d9d7a7e08457fd693f51ef30f73c1809585b5d7ea0f84574ca8a5cebb369cd05bcb0d099f830578ac33827f2de5ea0a7fb85d80cef2b5c7206c9c01cdaf375c7f4c3b0b506a3fb46b6012a9b8e48240fbca846b08f6732735ee2a5abba0cec29dfcd42d2ee3e74da056e7575bd6640800f265dd1cbae96c2a247a574b048350b06483ed4cce619a3405af6f728d6efb4ea919f05494b1cc12b03db09bf66cd96e4ef0997bc3a409fad3f4ca789fdeb4612dfb5d547cd4274c36582e3b51df1837237b2cb86b23bb6bd37e5e376a5ff476c9d14e82a1a4fc979f9a399c4c9f4d59023f4af3c2d19b0547b3327bfd4c94ad897ce71a7e541f69cd2baea5cd2628969389984d6f0383b14ec9ccfd80c43d1a2b538c485fee34e9772da87cfec10d286decf19bc54864c380c7f7ee122e1e22ec46d96ebdeaca00d2ee304570ad1bb5432147c2b54bef386e70460b1c9bfa7d157125541271f230024540e5a72ae5d5d593350ca672fb51a8dd3323a60185ad24b4f288400fed52d41b3d850cec313813bc5492ab771fb2914cbd78c086b040b0c0bb3d55184a758d41c7af14275b7ffdbc2ed4f8a9cd370cc5ee331a946ea11a337214cd3e1cb50d78d31fbdf867ff5ab58ef3471d7933c3f2451915efc84e15e07bf36c36c03a3f1a7b466aa0ae71dec3459ba5476b44c09b2f8c35d466363d839934ff96fec96609b0d734603e13324f866dc57c246b079ea03ddd4d89675307e498d6caa05aeaf8057bfdf603bbd183f1323785fa6e5105aa18d16b94c35e165629822e82acb50b4db09f9b11ccd6d3e69e4b6f78a83f10e907462dfd191e1e7fc1be17a90eb3f9bce9f82774f34598c38db52e1ed0dee7d15560e75757e7a5bbf06ba91d680a4285c913d48bd451b8ad4eaa5edd3e39eab11205d6986fce9a9f65fb4dbbea0ac2409b4d959bde5a27789dad8bdd7b8fbcfdcca10b073b3935d41a898135c66a15d17d00b48097033893f3183ea91c138cf0b0a96fe1c663b43f7494959b774fb160c71837b8aef35fe09c5fc1c92e0dc41cb491eebc82329975d01bec02b5d53134d020496a60ced4c0b8ec7cd22aab8dc7a5c3fbe8dd814b9acca54f2afa2a14f5dd2a85f87635efbf88e8cdba4dc2090e8e68d13102f4787542d97b16fa0a30183e45882bd6a7716a664042719c3dea20f7e5392e0a3a91c0f78bd2b5d0fc50baf2d0751f1ca17e1952a2abce48601f918328145c02bf5e98441ab3afffa9a89b13b779ad05bc26bb245ea98ec7fd5b1ff71c79aed4602f3dcea119843dcd89e16ab17f4895320e12f6a4d6ca96f81358d3e37db42d833cabc31789e8c154f0541b0a96ece7a48ac0d51f3d8aa844f69d70be94026071210cf579ae3a5121d846ca97515aeb3dcf96247f3239c0137d77bb0308f04b80c3d84c1cc994636fb744d5eed1684bd661732dce84c729f7e8fec0798b8dde418ce7d494edf4c3e6d3a5ec121f1588724c675db0f4722e25f083a566f44f8786f3203b3c64fbe5cc601d10a4a00535c35fcca5464e2aedd95d086729e1c0e506530eed0b939faa5e5f69fc01bfdf7abdd0155b45f2276c7a91595248bc585e07022d1cf6890122478f58d203892bbaa8fd1bc5079f034d63233517941bed2a41eecbcb005269218a1cc860dd9c2bff2ff9589c7aaf33ea5baf95f4f068018db13ee8fffb1a160a81e92077fb09f43503111cd13508b93dfe57a8483d24a58bc24965ff0f47375a4ec32fffc265329edbabe96e2a4f43bd2324d77e84af1c8d6ddd1314703b9d209ce98278bc26322bc0bcdcc0706cd31dc3eeb9f8d880a9aee95868e289dab941606a46eddd5d77dae9b00e25cc82380dc2214db35caecf5699726e89898813ab8276c2f6ac0dbfbf05d32744e9dc3f4bd972f8e01ad8a835640f46607efe170812aa9af038e9be69f0aa747f2057e048602abf5d51a2effaaeaeb729312aa9677e331308980ae44253dfb4765e1158cfa88b624988c486985485a0cde452c3ecc1c9ada1bdf88fc0295b9698dcc5b725d596bf86b8c3a08dc0869a12f6bf3b0258d6bb57da9f1e6cc2d3afc6e9ba3e9ad4cf8c88152e28783761766fa2ed5bca49311cb81e30a2500ba92626ec1dfc47836c51d402caeea187ba173dafbb8417c17fba99256355f8a120d0935e8ea0dd7d9f7460d8577d1b7b833c11d4c1384d23e7475979c1e2899664a9d6105b1ecc5e954cf5b097ab9a2e1e4755aa84c2e0fa6b82ad90da026b7b58c34a370591f7d10252cc95938ea7cef4e7e4b7ef0b80fe3abb6e08be34edd4e4a02a828d8a0c43c9da1e0f00f0fa8e00332a1604214e68039f242ebe499c6b0e6f6c27488365393242acf6136cb1b34805d8e766f5e5d68cbfdfde4d65f623e8dc5d925bc5aeb3859adc8e5185d2a254593e0f8ed267d4a29c144baa8793585cbc465b8750c2242c92129feaba1c1ec4f67a51cb2c430ebeb79bca3bbfe754d13ed7b477fdc70c9f5a01d12a3a4ecea7deba25a2fbfd5b6fed5323f2375d3c7060956a3510319d97638fbb6981b62a56f8e4687016b8d34c43991217d9466888637ebd6ffc9bcc466ad29325f278c16192dcda27060457a7dc833ccf7c451560a36b15bafd12b851ecc374b9243a990c3ff84500b730aeb323c70a47647f9fbe5a3895596df6bdb41fd8f15edf283eb97b9646cae6ec7434132ef8c32a476574dcc4b7dcb13f2c25e52e5b1fd912ad5df9cd83be1a1775bd903e5273978512e154ce056ae9fbe4a7f54b5d14890c6177bdfe80d82fd23c2e67f5a3fa8efcbf6e4498a1974a8ed41a47b213626ee04cd16ddded42e130717065c832c93e0e0ec85bead0671031e9cc15bb047ce82cc9acb47f0418d8a86199e418f47e21be3a97fc835e8c76b764271c607c350ac0f41ed7676494440d193deff74b3a24ff3e1ab1a029c5fdab683e929c8ec18fcfe3e7e5c68dbb7d14b097cea78b994ce82546c1e53de936002985daad0b4ade6a919dfb97058b13b1b03158e00d8c21e18102e7f1640514ddf25866cdd2d4e91</script> <div class="hbe hbe-content"> <div class="hbe hbe-input hbe-input-blink"> <input class="hbe hbe-input-field hbe-input-field-blink" type="password" id="hbePass"> <label class="hbe hbe-input-label hbe-input-label-blink" for="hbePass"> <span class="hbe hbe-input-label-content hbe-input-label-content-blink" data-content="请输入密码,访问当前内容。">请输入密码,访问当前内容。</span> </label> </div> </div></div><script data-pjax src="/lib/hbe.js"></script><link href="/css/hbe.style.css" rel="stylesheet" type="text/css">]]></content>
<summary type="html">这里有东西被加密了,点击输入密码查看哦。</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="TechNote" scheme="https://discover304.top/categories/NoteBook/TechNote/"/>
<category term="合作" scheme="https://discover304.top/tags/%E5%90%88%E4%BD%9C/"/>
<category term="AI" scheme="https://discover304.top/tags/AI/"/>
<category term="Large Language Models" scheme="https://discover304.top/tags/Large-Language-Models/"/>
<category term="Multi-Agent Systems" scheme="https://discover304.top/tags/Multi-Agent-Systems/"/>
<category term="Generative Agents" scheme="https://discover304.top/tags/Generative-Agents/"/>
<category term="Emergent Behavior" scheme="https://discover304.top/tags/Emergent-Behavior/"/>
</entry>
<entry>
<title>Navigating the Complexity of Mixture of Experts (MoE) in Multi-Modal Systems</title>
<link href="https://discover304.top/2024/09/21/2024q3/195-moe/"/>
<id>https://discover304.top/2024/09/21/2024q3/195-moe/</id>
<published>2024-09-21T08:26:16.000Z</published>
<updated>2024-10-03T17:28:56.117Z</updated>
<content type="html"><![CDATA[<h2 id="Introduction"><a href="#Introduction" class="headerlink" title="Introduction"></a>Introduction</h2><p>In the rapidly evolving field of artificial intelligence, integrating diverse data modalities—such as text, images, audio, and sensor data—poses significant challenges. Traditional monolithic AI models often struggle to handle the exponential complexity that arises when processing multiple modalities simultaneously. This is where the <strong>Mixture of Experts (MoE)</strong> framework demonstrates its true value. While MoE in isolation may seem less impactful compared to powerful single-model AI solutions, its application in <strong>multi-modal systems</strong> is transformative. By delegating each modality to specialized expert models, multi-modal MoE systems efficiently manage complexity, enabling more effective data processing and integration.</p><h2 id="Understanding-Mixture-of-Experts"><a href="#Understanding-Mixture-of-Experts" class="headerlink" title="Understanding Mixture of Experts"></a>Understanding Mixture of Experts</h2><h3 id="The-Role-of-Modality-in-MoE"><a href="#The-Role-of-Modality-in-MoE" class="headerlink" title="The Role of Modality in MoE"></a>The Role of Modality in MoE</h3><p>At its core, the Mixture of Experts architecture excels by leveraging the specialization of expert models, each finely tuned to handle a specific data modality. In multi-modal contexts, the differences between data types are substantial—textual data requires natural language processing techniques, images necessitate computer vision algorithms, and audio data demands signal processing methods. Attempting to build a single model capable of effectively processing all these modalities is often impractical due to the lack of sufficient aligned data and the vast differences in processing requirements. <strong>MoE addresses this by assigning each modality to an expert</strong>, thus simplifying the overall system design and improving performance.</p><h3 id="Current-Landscape"><a href="#Current-Landscape" class="headerlink" title="Current Landscape"></a>Current Landscape</h3><p>Currently, multi-modal MoE systems are at the forefront of applications that require the integration of diverse input types. Fields such as autonomous driving, multimedia content analysis, and virtual assistants rely heavily on processing multiple modalities simultaneously. For instance, an autonomous vehicle must interpret visual data from cameras, spatial data from LIDAR, and contextual data from GPS and maps. By utilizing specialized experts for each modality within an MoE framework, these systems can process complex inputs more effectively than traditional models.</p><h3 id="Challenges-and-Future-Directions"><a href="#Challenges-and-Future-Directions" class="headerlink" title="Challenges and Future Directions"></a>Challenges and Future Directions</h3><p>The primary challenge in multi-modal MoE systems lies in integrating an ever-increasing number of modalities. As the number of modalities grows, the <strong>complexity of the system increases exponentially</strong>. Aligning data from disparate sources to produce coherent outputs becomes more difficult, especially when modalities are not naturally aligned or synchronized. Moreover, there is often insufficient data that encompasses all modalities in a fully integrated manner, making it challenging to train a single model to handle everything.</p><p>Looking ahead, advancements in multi-modal MoE systems are expected to focus on improving the <strong>integration and alignment of modalities</strong>. Researchers are exploring methods to facilitate the incorporation of new modalities without requiring extensive reconfiguration of the system. This includes developing universal feature representations that can bridge different modalities and enable more seamless data integration.</p><h2 id="The-Significance-of-Multi-Modal-MoE-Systems"><a href="#The-Significance-of-Multi-Modal-MoE-Systems" class="headerlink" title="The Significance of Multi-Modal MoE Systems"></a>The Significance of Multi-Modal MoE Systems</h2><h3 id="Introduction-1"><a href="#Introduction-1" class="headerlink" title="Introduction"></a>Introduction</h3><p>Multi-modal MoE systems represent a critical innovation in AI, offering structured approaches to handling the complexities of diverse data types. As modalities increase, the complexity of processing and integrating them grows exponentially. Building a single model to tackle all modalities becomes unfeasible due to the lack of sufficient aligned data and the intrinsic differences between modalities. <strong>Multi-modal MoE systems address this by integrating as many data-specific experts as necessary, each handling their modality effectively</strong>.</p><h3 id="Current-State"><a href="#Current-State" class="headerlink" title="Current State"></a>Current State</h3><p>These systems are especially prevalent in fields that demand the simultaneous processing of varied data types. For example, in multimedia content analysis, combining textual, visual, and audio data allows for richer and more accurate content interpretation and recommendation. The precision with which multi-modal MoE systems handle each modality significantly outpaces traditional models that might struggle with the depth and nuance of such varied data.</p><h3 id="Challenges-and-Future-Projections"><a href="#Challenges-and-Future-Projections" class="headerlink" title="Challenges and Future Projections"></a>Challenges and Future Projections</h3><p>Despite their advantages, multi-modal MoE systems face significant challenges. One major issue is the integration of new modalities, which often requires extensive recalibration of the system and integration of new expert models. Aligning data from these varied sources to produce coherent outputs remains a complex task, particularly as the diversity and volume of data continue to grow.</p><p>Future projections for multi-modal MoE systems include enhancements in their adaptability and flexibility. Researchers are exploring methods to simplify the incorporation of new modalities, possibly through automated expert creation and integration processes. Additionally, the need for more sophisticated alignment techniques that can dynamically synchronize data from different modalities to maintain context and meaning is becoming increasingly clear.</p><h2 id="Implementing-Multi-Modal-MoE-with-LangChain"><a href="#Implementing-Multi-Modal-MoE-with-LangChain" class="headerlink" title="Implementing Multi-Modal MoE with LangChain"></a>Implementing Multi-Modal MoE with LangChain</h2><h3 id="Introduction-to-LangChain"><a href="#Introduction-to-LangChain" class="headerlink" title="Introduction to LangChain"></a>Introduction to LangChain</h3><p><a href="https://github.com/hwchase17/langchain">LangChain</a> provides a robust framework for implementing multi-modal MoE systems. Its modular architecture allows developers to create and manage specialized tools or agents—each acting as an expert for a specific modality. By simplifying the integration of these experts, LangChain enables efficient handling of diverse data types within a unified system.</p><h3 id="Practical-Implementation"><a href="#Practical-Implementation" class="headerlink" title="Practical Implementation"></a>Practical Implementation</h3><p>Below is a comprehensive example of how to set up a basic multi-modal MoE system using LangChain that can handle both text and image data:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> langchain.tools <span class="keyword">import</span> BaseTool</span><br><span class="line"></span><br><span class="line"><span class="comment"># Define an expert tool for processing text</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">TextExpertTool</span>(<span class="title class_ inherited__">BaseTool</span>):</span><br><span class="line"> name = <span class="string">"text_expert"</span></span><br><span class="line"></span><br><span class="line"> <span class="keyword">def</span> <span class="title function_">run</span>(<span class="params">self, input_text</span>):</span><br><span class="line"> <span class="comment"># Implement text processing logic here, e.g., sentiment analysis</span></span><br><span class="line"> <span class="keyword">return</span> <span class="string">f"Processed text: <span class="subst">{input_text}</span>"</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Define an expert tool for processing images</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">ImageExpertTool</span>(<span class="title class_ inherited__">BaseTool</span>):</span><br><span class="line"> name = <span class="string">"image_expert"</span></span><br><span class="line"></span><br><span class="line"> <span class="keyword">def</span> <span class="title function_">run</span>(<span class="params">self, input_image</span>):</span><br><span class="line"> <span class="comment"># Implement image processing logic here, e.g., object recognition</span></span><br><span class="line"> <span class="keyword">return</span> <span class="string">f"Processed image data: <span class="subst">{input_image}</span>"</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Define a gating function to decide which expert to use based on modality</span></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">gating_function</span>(<span class="params">input_data</span>):</span><br><span class="line"> <span class="keyword">if</span> <span class="built_in">isinstance</span>(input_data, <span class="built_in">str</span>):</span><br><span class="line"> <span class="keyword">return</span> <span class="string">"text_expert"</span></span><br><span class="line"> <span class="keyword">elif</span> <span class="built_in">isinstance</span>(input_data, <span class="built_in">bytes</span>): <span class="comment"># Assuming image data is in byte format</span></span><br><span class="line"> <span class="keyword">return</span> <span class="string">"image_expert"</span></span><br><span class="line"> <span class="keyword">else</span>:</span><br><span class="line"> <span class="keyword">raise</span> ValueError(<span class="string">"Unsupported input type"</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Implement the MoE Agent</span></span><br><span class="line"><span class="keyword">class</span> <span class="title class_">MoEAgent</span>:</span><br><span class="line"> <span class="keyword">def</span> <span class="title function_">__init__</span>(<span class="params">self, tools</span>):</span><br><span class="line"> <span class="variable language_">self</span>.tools = {tool.name: tool <span class="keyword">for</span> tool <span class="keyword">in</span> tools}</span><br><span class="line"></span><br><span class="line"> <span class="keyword">def</span> <span class="title function_">run</span>(<span class="params">self, input_data</span>):</span><br><span class="line"> expert_name = gating_function(input_data)</span><br><span class="line"> expert_tool = <span class="variable language_">self</span>.tools.get(expert_name)</span><br><span class="line"> <span class="keyword">if</span> <span class="keyword">not</span> expert_tool:</span><br><span class="line"> <span class="keyword">raise</span> ValueError(<span class="string">f"No expert found for the given input: <span class="subst">{expert_name}</span>"</span>)</span><br><span class="line"> <span class="keyword">return</span> expert_tool.run(input_data)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Example usage of the MoE system</span></span><br><span class="line">tools = [TextExpertTool(), ImageExpertTool()]</span><br><span class="line">moe_agent = MoEAgent(tools)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Test with a text input</span></span><br><span class="line">text_result = moe_agent.run(<span class="string">"Hello, this is a text example."</span>)</span><br><span class="line"><span class="built_in">print</span>(text_result)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Test with an image input (assuming image data is a byte string)</span></span><br><span class="line">image_result = moe_agent.run(<span class="string">b'\x89PNG\r\n\x1a\n...'</span>)</span><br><span class="line"><span class="built_in">print</span>(image_result)</span><br></pre></td></tr></table></figure><p>In this code:</p><ul><li><strong>TextExpertTool</strong> and <strong>ImageExpertTool</strong> are specialized experts for handling text and image data, respectively.</li><li>The <strong>gating_function</strong> routes input data to the appropriate expert based on the data modality.</li><li>The <strong>MoEAgent</strong> manages the experts and processes the input data using the correct expert.</li></ul><p>This modular approach allows the system to be easily extended with additional modalities by adding new expert tools and updating the gating function accordingly.</p><h3 id="Discussion"><a href="#Discussion" class="headerlink" title="Discussion"></a>Discussion</h3><p>The key to the success of multi-modal MoE systems is the effective handling of different modalities through specialized experts. By focusing on modality-specific processing, each expert can employ the most appropriate algorithms and techniques for its data type. This not only enhances performance but also simplifies the integration of new modalities, as each expert operates independently within the MoE framework.</p><p>While gating mechanisms are necessary for routing inputs, the primary challenge lies in <strong>managing the complexity introduced by multiple modalities</strong>. As more modalities are added, developers must ensure that the system remains coherent and that the integration of experts does not lead to conflicts or inefficiencies.</p><h2 id="Conclusion"><a href="#Conclusion" class="headerlink" title="Conclusion"></a>Conclusion</h2><p>Multi-modal Mixture of Experts systems represent a significant advancement in artificial intelligence, addressing the exponential complexity that arises from processing diverse data types. By delegating each modality to specialized expert models, these systems overcome the limitations of traditional monolithic models, which are often incapable of effectively handling all modalities due to the lack of sufficient aligned data and the inherent differences between data types.</p><p>Implementing multi-modal MoE systems with frameworks like LangChain empowers developers to build scalable and adaptable AI applications. By focusing on <strong>modality as the key aspect of MoE</strong>, these systems can efficiently integrate as many data types as necessary, each processed with expert-level precision. This approach not only enhances performance but also allows for the continuous expansion of the system as new modalities emerge.</p><p>As we continue to advance in the field of AI, the importance of modality-specific processing within MoE frameworks will only grow. The challenges associated with integrating multiple modalities will drive innovation, leading to more sophisticated methods for data alignment and expert coordination. Ultimately, embracing multi-modal MoE systems will enable the development of AI applications that more accurately reflect the complex, multi-faceted nature of real-world data.</p><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/yhbcode000">yhbcode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote>]]></content>
<summary type="html"><h2 id="Introduction"><a href="#Introduction" class="headerlink" title="Introduction"></a>Introduction</h2><p>In the rapidly evolving field </summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="TechNote" scheme="https://discover304.top/categories/NoteBook/TechNote/"/>
<category term="Mixture of Experts" scheme="https://discover304.top/tags/Mixture-of-Experts/"/>
<category term="Multi-Modal AI" scheme="https://discover304.top/tags/Multi-Modal-AI/"/>
<category term="LangChain" scheme="https://discover304.top/tags/LangChain/"/>
<category term="AI Architecture" scheme="https://discover304.top/tags/AI-Architecture/"/>
</entry>
<entry>
<title>Expanding Sustainability: Space Migration, Long-Lasting Products, and Humanity's Future</title>
<link href="https://discover304.top/2024/09/19/2024q3/194-sustainablility/"/>
<id>https://discover304.top/2024/09/19/2024q3/194-sustainablility/</id>
<published>2024-09-19T15:24:50.000Z</published>
<updated>2024-10-03T17:12:21.753Z</updated>
<content type="html"><![CDATA[<h2 id="Expanding-the-Concept-of-Sustainability-Beyond-Green-Energy-and-Into-Humanity’s-Future"><a href="#Expanding-the-Concept-of-Sustainability-Beyond-Green-Energy-and-Into-Humanity’s-Future" class="headerlink" title="Expanding the Concept of Sustainability: Beyond Green Energy and Into Humanity’s Future"></a>Expanding the Concept of Sustainability: Beyond Green Energy and Into Humanity’s Future</h2><p>When we hear the term “sustainability,” most people immediately think of environmental initiatives like renewable energy, reducing carbon footprints, or protecting ecosystems. While these are essential parts of the conversation, sustainability encompasses far more than just green energy. It’s a concept intricately tied to the long-term survival and flourishing of human society—what we could consider the “immortality” of human civilization. Sustainability, in its most profound sense, is about ensuring that humanity can thrive for generations to come by developing systems, technologies, and philosophies that support our continued existence across all dimensions—social, technological, and even cosmic.</p><h3 id="Sustainability-Is-More-Than-Just-Green-Energy"><a href="#Sustainability-Is-More-Than-Just-Green-Energy" class="headerlink" title="Sustainability Is More Than Just Green Energy"></a>Sustainability Is More Than Just Green Energy</h3><p>Many discussions about sustainability focus narrowly on environmental efforts. While crucial, they represent just one piece of the puzzle. True sustainability is not merely about preserving resources for today; it’s about creating resilient systems that can ensure humanity’s continued growth and success. This includes how we use our resources, how we structure our societies, and how we prepare for long-term risks that could jeopardize human survival. </p><p>In this broader context, sustainability extends beyond solar panels and recycling. It’s about ensuring that humanity, as a species, can continue to exist in the face of challenges such as technological evolution, economic changes, and even existential risks like natural disasters or global conflicts. This is where ideas like space migration and long-lasting product design come into play.</p><hr><h3 id="Space-Migration-A-Humanity-Sustainability-Project"><a href="#Space-Migration-A-Humanity-Sustainability-Project" class="headerlink" title="Space Migration: A Humanity Sustainability Project"></a>Space Migration: A Humanity Sustainability Project</h3><p>Space migration—once considered the domain of science fiction—is increasingly seen as a serious goal for the long-term sustainability of human civilization. If Earth’s resources are finite and environmental threats, such as climate change, are growing, expanding beyond our planet could provide a new frontier for human survival. Colonizing other planets, moons, or even building space stations could safeguard humanity from catastrophic events like asteroid impacts, ecological collapse, or widespread conflict.</p><p>From a sustainability perspective, space migration offers a way to “diversify” humanity’s existence. Just as companies diversify their assets to ensure long-term financial sustainability, space exploration offers a backup plan for human civilization. By extending our reach beyond Earth, we decrease the risks posed by depending on a single planet for our survival. In this sense, space migration isn’t just an exploration effort but a profound investment in the long-term sustainability of human society.</p><hr><h3 id="Long-Lasting-Products-A-Pathway-to-Sustainability"><a href="#Long-Lasting-Products-A-Pathway-to-Sustainability" class="headerlink" title="Long-Lasting Products: A Pathway to Sustainability"></a>Long-Lasting Products: A Pathway to Sustainability</h3><p>Sustainability isn’t only about finding new frontiers; it’s also about being more efficient with what we have. One significant aspect of this is the creation of long-lasting products. The current global economy often promotes a “throwaway” culture, where goods are made cheaply, used briefly, and then discarded. This cycle not only drains resources but also fills landfills and contributes to the destruction of ecosystems.</p><p>A shift toward long-lasting products directly addresses these issues. When products are designed to endure over time, the demand for raw materials decreases, the energy used for manufacturing is reduced, and the waste generated by disposal shrinks. In essence, durable goods contribute to resource efficiency and waste reduction—two critical aspects of sustainability. </p><p>However, long-lasting products aren’t just about environmental sustainability; they’re also about the stability of human systems. In a world where resources are finite and populations are growing, creating goods that last can support more resilient economies and societies. By relying on fewer resources to sustain consumer needs, we reduce the risk of resource scarcity and the conflicts that can arise from it.</p><hr><h3 id="Connecting-the-Dots-A-Holistic-Approach-to-Sustainability"><a href="#Connecting-the-Dots-A-Holistic-Approach-to-Sustainability" class="headerlink" title="Connecting the Dots: A Holistic Approach to Sustainability"></a>Connecting the Dots: A Holistic Approach to Sustainability</h3><p>When viewed through this broader lens, sustainability becomes a more comprehensive and future-oriented concept. It’s not just about preventing environmental degradation today but also about ensuring the long-term survival and prosperity of humanity in any context—whether on Earth or beyond. Space migration and long-lasting products are two examples of how we can think creatively about sustaining human civilization.</p><p><strong>Space migration</strong> prepares us for existential risks by diversifying our survival chances, while <strong>long-lasting products</strong> help us make the most of our limited resources, ensuring that future generations inherit a stable, resilient world. Together, they represent a forward-thinking approach to sustainability—one that goes beyond quick fixes and addresses the real, long-term needs of humanity.</p><hr><h3 id="Conclusion-Sustainability-as-Humanity’s-Long-Term-Strategy"><a href="#Conclusion-Sustainability-as-Humanity’s-Long-Term-Strategy" class="headerlink" title="Conclusion: Sustainability as Humanity’s Long-Term Strategy"></a>Conclusion: Sustainability as Humanity’s Long-Term Strategy</h3><p>Sustainability is not a trendy buzzword or a narrow goal limited to environmentalism; it’s a fundamental strategy for the long-term existence of human society. It involves a careful balance between immediate needs and future survival, whether through space exploration or creating durable products that minimize waste. </p><p>As we continue to develop new technologies and systems, we must broaden our definition of sustainability to include all aspects of human existence. By doing so, we can ensure that humanity not only survives but thrives for centuries—perhaps even millennia—to come.</p><hr><p><strong>What’s Next?</strong><br>For those interested in advancing sustainability, whether through technological innovation or social systems, the key is to think broadly. What steps can you take today to ensure the long-term prosperity of human society? Whether you’re working on long-lasting products, involved in space research, or rethinking social policies, sustainability starts with the realization that every action today shapes the future for generations to come.</p><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/yhbcode000">yhbcode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote>]]></content>
<summary type="html"><h2 id="Expanding-the-Concept-of-Sustainability-Beyond-Green-Energy-and-Into-Humanity’s-Future"><a href="#Expanding-the-Concept-of-Sustainab</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="ThinkingNote" scheme="https://discover304.top/categories/NoteBook/ThinkingNote/"/>
<category term="sustainability" scheme="https://discover304.top/tags/sustainability/"/>
<category term="space migration" scheme="https://discover304.top/tags/space-migration/"/>
<category term="long-lasting products" scheme="https://discover304.top/tags/long-lasting-products/"/>
<category term="human survival" scheme="https://discover304.top/tags/human-survival/"/>
<category term="future" scheme="https://discover304.top/tags/future/"/>
</entry>
<entry>
<title>196-Ai701</title>
<link href="https://discover304.top/2024/09/08/2024q3/draft/193-AI701/"/>
<id>https://discover304.top/2024/09/08/2024q3/draft/193-AI701/</id>
<published>2024-09-08T06:54:11.000Z</published>
<updated>2024-10-03T16:34:15.082Z</updated>
<content type="html"><![CDATA[<div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li class="tab"><button type="button" data-href="#-2">中文版本</button></li></ul><div class="tab-contents"><div class="tab-item-content active" id="-1"><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/yhbcode000">yhbcode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div><div class="tab-item-content" id="-2"><p>待更新</p><hr><blockquote><p><strong>🍀后记🍀</strong><br>博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。<br><strong>🌸唠嗑QQ群</strong>:<a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">兔叽の魔术工房</a> (942848525)<br><strong>⭐B站账号</strong>:<a href="https://space.bilibili.com/98639326">白拾ShiroX</a>(活跃于知识区和动画区)<br><strong>✨GitHub主页</strong>:<a href="https://github.com/yhbcode000">yhbcode000</a>(工程文件)<br><strong>⛳Discord社区</strong>:<a href="https://discord.g/nn5NDXMgae">AierLab</a>(人工智能社区)</p></blockquote><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div></div></div>]]></content>
<summary type="html"><div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li c</summary>
<category term="Draft" scheme="https://discover304.top/categories/Draft/"/>
<category term="待更新" scheme="https://discover304.top/tags/%E5%BE%85%E6%9B%B4%E6%96%B0/"/>
</entry>
<entry>
<title>191-ML701</title>
<link href="https://discover304.top/2024/09/08/2024q3/draft/192-ML701/"/>
<id>https://discover304.top/2024/09/08/2024q3/draft/192-ML701/</id>
<published>2024-09-08T06:53:54.000Z</published>
<updated>2024-09-08T10:53:54.832Z</updated>
<content type="html"><![CDATA[<div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li class="tab"><button type="button" data-href="#-2">中文版本</button></li></ul><div class="tab-contents"><div class="tab-item-content active" id="-1"><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div><div class="tab-item-content" id="-2"><p>待更新</p><hr><blockquote><p><strong>🍀后记🍀</strong><br>博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。<br><strong>🌸唠嗑QQ群</strong>:<a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">兔叽の魔术工房</a> (942848525)<br><strong>⭐B站账号</strong>:<a href="https://space.bilibili.com/98639326">白拾ShiroX</a>(活跃于知识区和动画区)<br><strong>✨GitHub主页</strong>:<a href="https://github.com/YangSierCode000">YangSierCode000</a>(工程文件)<br><strong>⛳Discord社区</strong>:<a href="https://discord.g/nn5NDXMgae">AierLab</a>(人工智能社区)</p></blockquote><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div></div></div>]]></content>
<summary type="html"><div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li c</summary>
<category term="Draft" scheme="https://discover304.top/categories/Draft/"/>
<category term="待更新" scheme="https://discover304.top/tags/%E5%BE%85%E6%9B%B4%E6%96%B0/"/>
</entry>
<entry>
<title>190-ROB701.md</title>
<link href="https://discover304.top/2024/09/08/2024q3/draft/191-ROB701/"/>
<id>https://discover304.top/2024/09/08/2024q3/draft/191-ROB701/</id>
<published>2024-09-08T06:51:57.000Z</published>
<updated>2024-09-08T10:51:57.305Z</updated>
<content type="html"><![CDATA[<div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li class="tab"><button type="button" data-href="#-2">中文版本</button></li></ul><div class="tab-contents"><div class="tab-item-content active" id="-1"><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div><div class="tab-item-content" id="-2"><p>待更新</p><hr><blockquote><p><strong>🍀后记🍀</strong><br>博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。<br><strong>🌸唠嗑QQ群</strong>:<a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">兔叽の魔术工房</a> (942848525)<br><strong>⭐B站账号</strong>:<a href="https://space.bilibili.com/98639326">白拾ShiroX</a>(活跃于知识区和动画区)<br><strong>✨GitHub主页</strong>:<a href="https://github.com/YangSierCode000">YangSierCode000</a>(工程文件)<br><strong>⛳Discord社区</strong>:<a href="https://discord.g/nn5NDXMgae">AierLab</a>(人工智能社区)</p></blockquote><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div></div></div>]]></content>
<summary type="html"><div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li c</summary>
<category term="Draft" scheme="https://discover304.top/categories/Draft/"/>
<category term="待更新" scheme="https://discover304.top/tags/%E5%BE%85%E6%9B%B4%E6%96%B0/"/>
</entry>
<entry>
<title>190-Stock-Trade</title>
<link href="https://discover304.top/2024/08/30/2024q3/draft/190-stock-trade/"/>
<id>https://discover304.top/2024/08/30/2024q3/draft/190-stock-trade/</id>
<published>2024-08-30T16:19:55.000Z</published>
<updated>2024-08-30T20:47:12.453Z</updated>
<content type="html"><![CDATA[<div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li class="tab"><button type="button" data-href="#-2">中文版本</button></li></ul><div class="tab-contents"><div class="tab-item-content active" id="-1"><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div><div class="tab-item-content" id="-2"><ol><li>开仓成本和平仓成本。</li><li>连续单点交易,在正常情况下,能够满足一个上升或者下降周期中一半的百分比。</li><li>卖出的标准是趋势momentum换向。</li><li>这里我们需要判断最小的交易成本该多少合适,给定波动的百分比,那么一半百分比上升带来的收益需要大于等于中间的连续交易的成本。</li><li>所以单次交易该交易多少,一来是与波动百分比的一半正比,与连续交易次数成反比(因为可以连续交易的次数有限,本金有限)。</li></ol><hr><blockquote><p><strong>🍀后记🍀</strong><br>博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。<br><strong>🌸唠嗑QQ群</strong>:<a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">兔叽の魔术工房</a> (942848525)<br><strong>⭐B站账号</strong>:<a href="https://space.bilibili.com/98639326">白拾ShiroX</a>(活跃于知识区和动画区)<br><strong>✨GitHub主页</strong>:<a href="https://github.com/YangSierCode000">YangSierCode000</a>(工程文件)<br><strong>⛳Discord社区</strong>:<a href="https://discord.g/nn5NDXMgae">AierLab</a>(人工智能社区)</p></blockquote><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div></div></div>]]></content>
<summary type="html"><div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li c</summary>
<category term="Draft" scheme="https://discover304.top/categories/Draft/"/>
<category term="待更新" scheme="https://discover304.top/tags/%E5%BE%85%E6%9B%B4%E6%96%B0/"/>
</entry>
<entry>
<title>Introduction to Image Processing With Scikit-Image</title>
<link href="https://discover304.top/2024/08/20/2024q3/189-6/"/>
<id>https://discover304.top/2024/08/20/2024q3/189-6/</id>
<published>2024-08-20T14:11:23.000Z</published>
<updated>2024-10-03T17:33:13.530Z</updated>
<content type="html"><![CDATA[<p><strong>Introduction</strong></p><p>In the vast field of data science, image processing has carved out a significant niche, providing tools and techniques to analyze and manipulate visual data. Python, with its rich ecosystem of libraries, offers several options for working with images. Among these, scikit-image stands out as a powerful, accessible tool dedicated to image processing, using NumPy arrays as image objects for easy integration with other scientific Python libraries.</p><p>In this post, we’ll explore how to use scikit-image to read images into NumPy arrays and visualize them using Matplotlib, illustrating the basics with a simple example.</p><p><strong>Getting Started with scikit-image</strong></p><p>Scikit-image is built on NumPy and Matplotlib, making it a great choice for tasks that require manipulation and analysis of pixels. Let’s start by reading and displaying an image.</p><p><strong>Reading and Displaying an Image</strong></p><p>Here’s how you can read and display an image with scikit-image:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> skimage <span class="keyword">import</span> data</span><br><span class="line"><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</span><br><span class="line"></span><br><span class="line"><span class="comment"># Load an example image from scikit-image's data module</span></span><br><span class="line">img = data.astronaut()</span><br><span class="line"></span><br><span class="line"><span class="comment"># Display the image</span></span><br><span class="line">plt.imshow(img)</span><br><span class="line">plt.show()</span><br></pre></td></tr></table></figure><p>This code snippet loads an example image (an astronaut) from scikit-image’s extensive collection of demo images and displays it using Matplotlib’s <code>imshow</code> function.</p><p><strong>Exploring Image Properties</strong></p><p>Understanding an image’s properties is essential for processing tasks. Here’s how you can examine basic properties like size and color channels:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Dimension of image: pixels in (rows, columns)</span></span><br><span class="line">img_size = img.shape</span><br><span class="line"><span class="built_in">print</span>(<span class="string">'Size of image: \n{} \n'</span>.<span class="built_in">format</span>(img_size))</span><br><span class="line"></span><br><span class="line"><span class="comment"># Extract dimensions</span></span><br><span class="line">dim1, dim2 = img.shape[<span class="number">0</span>], img.shape[<span class="number">1</span>]</span><br><span class="line">num_channels = img.shape[<span class="number">2</span>]</span><br><span class="line"></span><br><span class="line"><span class="comment"># RGB Colour image has three channels: Red, Green, Blue</span></span><br><span class="line"><span class="built_in">print</span>(<span class="string">'No. of channels: \n{}'</span>.<span class="built_in">format</span>(num_channels))</span><br></pre></td></tr></table></figure><p>This will output the dimensions of the image and the number of color channels, which is crucial for further manipulation, such as filtering, resizing, or color adjustments.</p><p><strong>Additional Tips</strong></p><p>While we used a built-in image for simplicity, scikit-image can load images from any URL using the <code>io</code> module, as shown below:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> skimage <span class="keyword">import</span> io</span><br><span class="line"></span><br><span class="line"><span class="comment"># Importing an image from a URL</span></span><br><span class="line">img = io.imread(<span class="string">'url_here'</span>)</span><br></pre></td></tr></table></figure><p>This flexibility makes scikit-image a handy tool for working with a vast range of image data sources.</p><p><strong>Conclusion</strong></p><p>Scikit-image paired with Matplotlib provides a robust set of tools for image processing tasks in Python. Whether you’re a beginner looking to understand the basics of image data or an advanced user working on complex image analysis projects, scikit-image offers the functions and simplicity required to accomplish these tasks efficiently.</p><p>By learning how to manipulate images using these libraries, you can unlock a deeper understanding of image analysis techniques and their applications in real-world scenarios.</p><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote>]]></content>
<summary type="html"><p><strong>Introduction</strong></p>
<p>In the vast field of data science, image processing has carved out a significant niche, providing to</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="PythonNote" scheme="https://discover304.top/categories/NoteBook/PythonNote/"/>
<category term="Python" scheme="https://discover304.top/tags/Python/"/>
<category term="Data Science" scheme="https://discover304.top/tags/Data-Science/"/>
<category term="scikit-image" scheme="https://discover304.top/tags/scikit-image/"/>
<category term="Image Processing" scheme="https://discover304.top/tags/Image-Processing/"/>
</entry>
<entry>
<title>Understanding the Anatomy of a Matplotlib Figure</title>
<link href="https://discover304.top/2024/08/20/2024q3/189-5/"/>
<id>https://discover304.top/2024/08/20/2024q3/189-5/</id>
<published>2024-08-20T14:11:20.000Z</published>
<updated>2024-10-03T17:30:59.984Z</updated>
<content type="html"><![CDATA[<p><strong>Introduction</strong></p><p>Matplotlib is one of the most popular Python libraries for data visualization. It provides an extensive range of tools to plot graphs that are highly customizable and suitable for a wide array of applications. Whether you are a data scientist, an engineer, or anyone who deals with graphical representations of data, understanding how to manipulate and customize your plots in Matplotlib can greatly enhance your ability to communicate data insights effectively.</p><p>In this post, we will explore the structure of a Matplotlib figure, breaking down its components and explaining each part’s role in creating a visualization.</p><p><strong>Key Components of a Matplotlib Figure</strong></p><p>A Matplotlib visualization is made up of several interlinked elements, and understanding these is crucial for effective plot customization. Here’s an overview of the essential parts:</p><ol><li><p><strong>Figure</strong></p><p>The entire window or the page the plot is drawn on. Think of it as the canvas of your artwork. It is the top-level container for all the plot elements. A single figure can contain any number of Axes.</p></li><li><p><strong>Axes</strong></p><p>This is what you might think of as ‘a plot.’ An Axes is an individual plot or graph. Despite the name, a single Axes object can have multiple plot types layered on top of each other. Each Axes has an X-Axis and a Y-Axis (and a Z-Axis in case of 3D). These contain the ticks, tick locations, labels, etc., that frame the plot. The Axes contains two (or three) Axis objects which handle the data limits.</p></li><li><p><strong>Axis</strong></p><p>These are the number line-like objects that control the graph limits, the ticks (the marks on the Axis), and the labels on these ticks. They are responsible for generating the graph limits and organizing the tick marks.</p></li><li><p><strong>Artist</strong></p><p>Everything you can see on the figure is an artist, including Text objects, Line2D objects, collection objects, and even the Axes and Figure objects themselves. In essence, all visible elements in the plot are collectively referred to as artists.</p></li></ol><p><strong>The Roles Each Component Plays</strong></p><p>Understanding each component’s role can help you manipulate and utilize them effectively to create complex and detailed visualizations.</p><ul><li><strong>Figure</strong>: Manages the outer framework of the plot including the canvas background, and acts as a container for one or more Axes.</li><li><strong>Axes</strong>: Hosts the plot elements and provides the interface for plotting. It is where most of the Matplotlib API plotting methods are applied.</li><li><strong>Axis</strong>: Manages the scale and limits of the data being plotted, including ticks and tick labels.</li><li><strong>Artist</strong>: The visible elements that are drawn onto the canvas.</li></ul><p><strong>Putting It All Together</strong></p><p>To see these components in action, here’s a quick example using Python and Matplotlib:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</span><br><span class="line"></span><br><span class="line"><span class="comment"># Create a Figure</span></span><br><span class="line">fig = plt.figure(figsize=(<span class="number">6</span>,<span class="number">4</span>))</span><br><span class="line"></span><br><span class="line"><span class="comment"># Add Axes to the Figure</span></span><br><span class="line">ax = fig.add_subplot(<span class="number">111</span>) <span class="comment"># 111 means "1x1 grid, first subplot"</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Plot data</span></span><br><span class="line">ax.plot([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">10</span>], [<span class="number">10</span>, <span class="number">20</span>, <span class="number">25</span>, <span class="number">30</span>, <span class="number">40</span>])</span><br><span class="line"></span><br><span class="line"><span class="comment"># Customize the Axis</span></span><br><span class="line">ax.set_xlim(<span class="number">0</span>, <span class="number">5</span>)</span><br><span class="line">ax.set_ylim(<span class="number">0</span>, <span class="number">50</span>)</span><br><span class="line">ax.set_xlabel(<span class="string">'X Axis Label'</span>)</span><br><span class="line">ax.set_ylabel(<span class="string">'Y Axis Label'</span>)</span><br><span class="line">ax.set_title(<span class="string">'Sample Plot'</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Show the plot</span></span><br><span class="line">plt.show()</span><br></pre></td></tr></table></figure><p><strong>Conclusion</strong></p><p>The ability to understand and manipulate the components of a Matplotlib figure is crucial for anyone looking to create detailed and specific graphical data representations. Each element of a Matplotlib plot serves a specific purpose, and knowing how these work together allows for better control over the appearance and behavior of your plots. By mastering the structure of Matplotlib figures, you can make your data visualization tasks much more intuitive and effective.</p><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote>]]></content>
<summary type="html"><p><strong>Introduction</strong></p>
<p>Matplotlib is one of the most popular Python libraries for data visualization. It provides an extens</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="PythonNote" scheme="https://discover304.top/categories/NoteBook/PythonNote/"/>
<category term="Python" scheme="https://discover304.top/tags/Python/"/>
<category term="Data Science" scheme="https://discover304.top/tags/Data-Science/"/>
<category term="Matplotlib" scheme="https://discover304.top/tags/Matplotlib/"/>
<category term="Data Visualization" scheme="https://discover304.top/tags/Data-Visualization/"/>
</entry>
<entry>
<title>Evaluating Classification Models With `Classification_report` in Scikit-Learn</title>
<link href="https://discover304.top/2024/08/20/2024q3/189-4/"/>
<id>https://discover304.top/2024/08/20/2024q3/189-4/</id>
<published>2024-08-20T14:11:17.000Z</published>
<updated>2024-10-03T17:33:58.325Z</updated>
<content type="html"><![CDATA[<p><strong>Introduction</strong></p><p>In the realm of machine learning, evaluating the performance of a classification model is crucial. scikit-learn, a powerful tool for machine learning in Python, provides several utilities for model evaluation. One of the most useful functions is <code>classification_report</code>, which gives a comprehensive overview of the key metrics for a classification model. In this post, we’ll explore how to use this function to assess model performance effectively.</p><p><strong>What is <code>classification_report</code>?</strong></p><p>The <code>classification_report</code> function in scikit-learn’s <code>metrics</code> module generates a report showing the main classification metrics on a per-class basis. This makes it easier to understand the performance of the model across different categories, providing insights into how well the model is identifying each class.</p><p><strong>Metrics Explained</strong></p><p>The <code>classification_report</code> outputs the following metrics for each class:</p><ul><li><strong>Precision</strong>: The ratio of correctly predicted positive observations to the total predicted positives. It is a measure of a classifier’s exactness. High precision relates to a low false positive rate.</li><li><strong>Recall</strong>: The ratio of correctly predicted positive observations to the all observations in actual class. It is a measure of a classifier’s completeness.</li><li><strong>F1 Score</strong>: The weighted average of Precision and Recall. This score takes both false positives and false negatives into account. It is particularly useful when the class distribution is uneven.</li><li><strong>Support</strong>: The number of actual occurrences of the class in the specified dataset. Useful for assessing how representative the reported metrics are.</li></ul><p><strong>Using <code>classification_report</code></strong></p><p>To use <code>classification_report</code>, you first need a trained model and a test dataset. Here’s a step-by-step guide on implementing it:</p><ol><li><strong>Import the necessary modules and load data</strong>:</li></ol><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> sklearn <span class="keyword">import</span> datasets</span><br><span class="line"><span class="keyword">from</span> sklearn.model_selection <span class="keyword">import</span> train_test_split</span><br><span class="line"><span class="keyword">from</span> sklearn.ensemble <span class="keyword">import</span> RandomForestClassifier</span><br><span class="line"><span class="keyword">from</span> sklearn.metrics <span class="keyword">import</span> classification_report</span><br><span class="line"></span><br><span class="line"><span class="comment"># Load the Iris dataset</span></span><br><span class="line">iris = datasets.load_iris()</span><br><span class="line">X, y = iris.data, iris.target</span><br></pre></td></tr></table></figure><ol start="2"><li><strong>Split the data into training and testing sets</strong>:</li></ol><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=<span class="number">0.3</span>, random_state=<span class="number">42</span>)</span><br></pre></td></tr></table></figure><ol start="3"><li><strong>Train a classification model</strong>:</li></ol><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">model = RandomForestClassifier(random_state=<span class="number">42</span>)</span><br><span class="line">model.fit(X_train, y_train)</span><br></pre></td></tr></table></figure><ol start="4"><li><strong>Predict on the testing set</strong>:</li></ol><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">y_pred = model.predict(X_test)</span><br></pre></td></tr></table></figure><ol start="5"><li><strong>Generate and print the classification report</strong>:</li></ol><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">report = classification_report(y_test, y_pred, target_names=iris.target_names)</span><br><span class="line"><span class="built_in">print</span>(report)</span><br></pre></td></tr></table></figure><p><strong>Example Output</strong></p><p>The output will display the precision, recall, f1-score, and support for each class, followed by the averages for these metrics:</p><figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"> <span class="attribute">precision</span> recall f1-score support</span><br><span class="line"></span><br><span class="line"> <span class="attribute">setosa</span> <span class="number">1</span>.<span class="number">00</span> <span class="number">1</span>.<span class="number">00</span> <span class="number">1</span>.<span class="number">00</span> <span class="number">19</span></span><br><span class="line"> <span class="attribute">versicolor</span> <span class="number">1</span>.<span class="number">00</span> <span class="number">0</span>.<span class="number">90</span> <span class="number">0</span>.<span class="number">95</span> <span class="number">10</span></span><br><span class="line"> <span class="attribute">virginica</span> <span class="number">0</span>.<span class="number">88</span> <span class="number">1</span>.<span class="number">00</span> <span class="number">0</span>.<span class="number">93</span> <span class="number">14</span></span><br><span class="line"></span><br><span class="line"><span class="attribute">avg</span> / total <span class="number">0</span>.<span class="number">96</span> <span class="number">0</span>.<span class="number">96</span> <span class="number">0</span>.<span class="number">96</span> <span class="number">43</span></span><br></pre></td></tr></table></figure><p><strong>Conclusion</strong></p><p>The <code>classification_report</code> from scikit-learn provides a detailed assessment of a model’s performance. By understanding these metrics, you can better tune your model and potentially improve its accuracy and reliability. Whether you’re working on a simple binary classification task or a more complex multi-class problem, the <code>classification_report</code> offers valuable insights into your model’s capabilities and areas for improvement.</p><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote>]]></content>
<summary type="html"><p><strong>Introduction</strong></p>
<p>In the realm of machine learning, evaluating the performance of a classification model is crucial. s</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="TechNote" scheme="https://discover304.top/categories/NoteBook/TechNote/"/>
<category term="Python" scheme="https://discover304.top/tags/Python/"/>
<category term="Machine Learning" scheme="https://discover304.top/tags/Machine-Learning/"/>
<category term="scikit-learn" scheme="https://discover304.top/tags/scikit-learn/"/>
<category term="Classification" scheme="https://discover304.top/tags/Classification/"/>
</entry>
<entry>
<title>A Quick Guide to Linear Algebra With NumPy</title>
<link href="https://discover304.top/2024/08/20/2024q3/189-3/"/>
<id>https://discover304.top/2024/08/20/2024q3/189-3/</id>
<published>2024-08-20T14:11:14.000Z</published>
<updated>2024-10-03T17:37:12.975Z</updated>
<content type="html"><![CDATA[<p><strong>Introduction</strong></p><p>NumPy is a fundamental package for numerical computing in Python. It provides efficient operations for handling arrays and matrices, which are crucial for data analysis and scientific computing. In this guide, we’ll explore some basic linear algebra operations available in NumPy, showcasing how to perform these operations both with operator overloads and built-in functions.</p><p><strong>Elementwise Operations</strong></p><p>Elementwise operations are basic operations that are applied element by element on arrays. These operations are the building blocks for more complex mathematical computations in data science and engineering tasks.</p><p><strong>Addition and Subtraction</strong></p><p>Let’s start by creating two simple arrays and performing elementwise addition and subtraction:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"></span><br><span class="line">a = np.array([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>])</span><br><span class="line">b = np.array([<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>])</span><br><span class="line"></span><br><span class="line"><span class="comment"># Elementwise Addition</span></span><br><span class="line"><span class="built_in">print</span>(a + b) <span class="comment"># Output: [5 7 9]</span></span><br><span class="line"><span class="built_in">print</span>(np.add(a, b)) <span class="comment"># Output: [5 7 9]</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Elementwise Subtraction</span></span><br><span class="line"><span class="built_in">print</span>(a - b) <span class="comment"># Output: [-3 -3 -3]</span></span><br><span class="line"><span class="built_in">print</span>(np.subtract(a, b)) <span class="comment"># Output: [-3 -3 -3]</span></span><br></pre></td></tr></table></figure><p><strong>Vector and Matrix Multiplication</strong></p><p>Beyond basic arithmetic, NumPy supports various matrix operations, including dot products, matrix multiplication, and more.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Inner Product of Vectors</span></span><br><span class="line">c = np.dot(a, b)</span><br><span class="line"><span class="built_in">print</span>(c) <span class="comment"># Output: 32</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Matrix Multiplication</span></span><br><span class="line">a = [[<span class="number">1</span>, <span class="number">0</span>], [<span class="number">0</span>, <span class="number">1</span>]]</span><br><span class="line">b = [[<span class="number">4</span>, <span class="number">1</span>], [<span class="number">2</span>, <span class="number">2</span>]]</span><br><span class="line">c = np.matmul(a, b)</span><br><span class="line"><span class="built_in">print</span>(c) <span class="comment"># Output: [[4 1] [2 2]]</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Using @ operator for Matrix Multiplication</span></span><br><span class="line">a_array = np.array(a)</span><br><span class="line">b_array = np.array(b)</span><br><span class="line">c = a_array @ b_array</span><br><span class="line"><span class="built_in">print</span>(c) <span class="comment"># Output: [[4 1] [2 2]]</span></span><br></pre></td></tr></table></figure><p><strong>Advanced Matrix Operations</strong></p><p>NumPy also provides functions to perform more complex matrix operations like inversion, determinant calculation, and matrix transposition.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Matrix Inversion</span></span><br><span class="line">a = np.array([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]])</span><br><span class="line">b = np.linalg.inv(a)</span><br><span class="line"><span class="built_in">print</span>(a)</span><br><span class="line"><span class="built_in">print</span>(b) <span class="comment"># Outputs the inverse of matrix a</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Determinant of a Matrix</span></span><br><span class="line"><span class="built_in">print</span>(np.linalg.det(a)) <span class="comment"># Output: -2.0</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Matrix Transpose</span></span><br><span class="line">a = np.arange(<span class="number">12</span>).reshape(<span class="number">3</span>, <span class="number">4</span>)</span><br><span class="line"><span class="built_in">print</span>(a)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">'\n'</span>)</span><br><span class="line"><span class="built_in">print</span>(a.T) <span class="comment"># Transpose of matrix a</span></span><br></pre></td></tr></table></figure><p><strong>Creating Identity and Eye Matrices</strong></p><p>Creating specific types of matrices like identity matrices is straightforward in NumPy:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> numpy.matlib</span><br><span class="line"><span class="built_in">print</span>(np.matlib.identity(<span class="number">5</span>)) <span class="comment"># Identity matrix of size 5x5</span></span><br><span class="line"><span class="built_in">print</span>(np.eye(<span class="number">5</span>)) <span class="comment"># Identity matrix using eye function</span></span><br></pre></td></tr></table></figure><p><strong>Conclusion</strong></p><p>NumPy makes it simple to perform a variety of linear algebra operations, which are essential for many applications in science and engineering. Understanding these basics allows you to handle more complex tasks efficiently with Python. Whether you are performing simple elementwise operations or complex matrix multiplications, NumPy provides the functionality to do it quickly and effectively.</p><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote>]]></content>
<summary type="html"><p><strong>Introduction</strong></p>
<p>NumPy is a fundamental package for numerical computing in Python. It provides efficient operations f</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="PythonNote" scheme="https://discover304.top/categories/NoteBook/PythonNote/"/>
<category term="Python" scheme="https://discover304.top/tags/Python/"/>
<category term="Data Science" scheme="https://discover304.top/tags/Data-Science/"/>
<category term="NumPy" scheme="https://discover304.top/tags/NumPy/"/>
<category term="Linear Algebra" scheme="https://discover304.top/tags/Linear-Algebra/"/>
</entry>
<entry>
<title>Understanding Array Slicing in NumPy: A Practical Guide</title>
<link href="https://discover304.top/2024/08/20/2024q3/189-2/"/>
<id>https://discover304.top/2024/08/20/2024q3/189-2/</id>
<published>2024-08-20T14:11:08.000Z</published>
<updated>2024-10-03T17:38:18.069Z</updated>
<content type="html"><![CDATA[<p><strong>Introduction</strong></p><p>In the world of data manipulation with Python, NumPy stands as one of the most used libraries due to its efficiency and powerful array operations. One common operation is array slicing, which can be a bit tricky to understand, especially for those new to Python. In this blog post, we’ll delve into how slicing works in NumPy and why it’s important to understand its behavior to avoid potential bugs in your code.</p><p><strong>Creating a Basic Array</strong></p><p>To begin, let’s create a simple rank 2 NumPy array with the shape (3, 4). This array will consist of 12 elements arranged in three rows and four columns:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"></span><br><span class="line">a = np.array([[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>],</span><br><span class="line"> [<span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>, <span class="number">8</span>],</span><br><span class="line"> [<span class="number">9</span>, <span class="number">10</span>, <span class="number">11</span>, <span class="number">12</span>]])</span><br></pre></td></tr></table></figure><p><strong>Slicing the Array</strong></p><p>NumPy arrays allow for a wide variety of slicing options, making it easy to extract portions of an array. Let’s say we want to extract a subarray consisting of the first two rows and the second and third columns:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">b = a[:<span class="number">2</span>, <span class="number">1</span>:<span class="number">3</span>]</span><br></pre></td></tr></table></figure><p>This slice operation creates a new array <code>b</code> with the shape (2, 2), looking like this:</p><figure class="highlight lua"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">[[2 3]</span></span><br><span class="line"><span class="string"> [6 7]]</span></span><br></pre></td></tr></table></figure><p>Here’s how we do it in code:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">print</span>(b)</span><br></pre></td></tr></table></figure><p><strong>Understanding the Connection</strong></p><p>When you perform a slice operation in NumPy, it doesn’t create a new independent array. Instead, the slice is a view on the original array. This is an essential aspect of NumPy design that makes array manipulation more memory efficient but can lead to confusion about the linkage between the original array and the slice. Let’s demonstrate this:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">print</span>(a[<span class="number">0</span>, <span class="number">1</span>]) <span class="comment"># Output will be 2</span></span><br><span class="line">b[<span class="number">0</span>, <span class="number">0</span>] = <span class="number">77</span> <span class="comment"># Modify the slice</span></span><br><span class="line"><span class="built_in">print</span>(a[<span class="number">0</span>, <span class="number">1</span>]) <span class="comment"># Output will be 77</span></span><br></pre></td></tr></table></figure><p>Notice how changing the value of <code>b[0, 0]</code> also changed <code>a[0, 1]</code>. This happens because the slice <code>b</code> is just a view of the same data in <code>a</code>.</p><p><strong>Conclusion</strong></p><p>Understanding that slices in NumPy are views and not copies can help prevent unintended side-effects in your programs. When you modify a slice, you’re actually modifying the underlying array data. This behavior is by design, enhancing performance by avoiding unnecessary data copies. However, if you need an independent copy of a slice, you should use the <code>.copy()</code> method to explicitly make a duplicate of the array data.</p><p>This simple example illustrates how powerful and efficient NumPy is for data manipulation, but also highlights the importance of understanding its inner workings. Happy coding!</p><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote>]]></content>
<summary type="html"><p><strong>Introduction</strong></p>
<p>In the world of data manipulation with Python, NumPy stands as one of the most used libraries due to</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="PythonNote" scheme="https://discover304.top/categories/NoteBook/PythonNote/"/>
<category term="Python" scheme="https://discover304.top/tags/Python/"/>
<category term="NumPy" scheme="https://discover304.top/tags/NumPy/"/>
<category term="Array Slicing" scheme="https://discover304.top/tags/Array-Slicing/"/>
<category term="Data Manipulation" scheme="https://discover304.top/tags/Data-Manipulation/"/>
</entry>
<entry>
<title>How to Install and Manage Conda Environments Using .Yml Files</title>
<link href="https://discover304.top/2024/08/20/2024q3/189-1-conda-yml/"/>
<id>https://discover304.top/2024/08/20/2024q3/189-1-conda-yml/</id>
<published>2024-08-20T14:02:05.000Z</published>
<updated>2024-10-03T17:40:26.694Z</updated>
<content type="html"><![CDATA[<p>To install a Conda environment from a <code>.yml</code> file, follow these steps:</p><h3 id="1-Prepare-the-yml-File"><a href="#1-Prepare-the-yml-File" class="headerlink" title="1. Prepare the .yml File"></a>1. <strong>Prepare the <code>.yml</code> File</strong></h3><p>Ensure you have a <code>.yml</code> file that defines the Conda environment. This file typically includes dependencies and configuration settings for the environment. It might look something like this:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">name:</span> <span class="string">myenv</span></span><br><span class="line"><span class="attr">channels:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">defaults</span></span><br><span class="line"><span class="attr">dependencies:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">python=3.8</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">numpy</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">pandas</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">scipy</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">pip</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">pip:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">torch</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">torchvision</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">torchaudio</span></span><br></pre></td></tr></table></figure><h3 id="2-Install-Conda-if-not-already-installed"><a href="#2-Install-Conda-if-not-already-installed" class="headerlink" title="2. Install Conda (if not already installed)"></a>2. <strong>Install Conda (if not already installed)</strong></h3><p>If you haven’t installed Conda, you can download and install Miniconda or Anaconda:</p><ul><li><strong>Miniconda</strong>: A minimal installer for Conda. <a href="https://docs.conda.io/en/latest/miniconda.html">Download Miniconda</a></li><li><strong>Anaconda</strong>: A larger distribution that includes Conda, Python, and many scientific packages. <a href="https://www.anaconda.com/products/distribution">Download Anaconda</a></li></ul><h3 id="3-Create-the-Environment"><a href="#3-Create-the-Environment" class="headerlink" title="3. Create the Environment"></a>3. <strong>Create the Environment</strong></h3><p>Open your terminal (or Anaconda Prompt on Windows) and navigate to the directory where your <code>.yml</code> file is located. Run the following command to create the Conda environment from the <code>.yml</code> file:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda <span class="built_in">env</span> create -f environment.yml</span><br></pre></td></tr></table></figure><p>Replace <code>environment.yml</code> with the name of your <code>.yml</code> file if it’s different.</p><h3 id="4-Activate-the-Environment"><a href="#4-Activate-the-Environment" class="headerlink" title="4. Activate the Environment"></a>4. <strong>Activate the Environment</strong></h3><p>After the environment is created, activate it with:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda activate myenv</span><br></pre></td></tr></table></figure><p>Replace <code>myenv</code> with the name specified in the <code>.yml</code> file under the <code>name</code> field.</p><h3 id="5-Verify-the-Environment"><a href="#5-Verify-the-Environment" class="headerlink" title="5. Verify the Environment"></a>5. <strong>Verify the Environment</strong></h3><p>You can check that the environment is correctly set up by listing the installed packages:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda list</span><br></pre></td></tr></table></figure><h3 id="6-Update-or-Export-the-Environment"><a href="#6-Update-or-Export-the-Environment" class="headerlink" title="6. Update or Export the Environment"></a>6. <strong>Update or Export the Environment</strong></h3><ul><li><p><strong>To update an environment</strong>: Modify the <code>.yml</code> file and run the command again:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda <span class="built_in">env</span> update -f environment.yml</span><br></pre></td></tr></table></figure></li><li><p><strong>To export the environment</strong>: You can create a <code>.yml</code> file from an existing environment with:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">conda <span class="built_in">env</span> <span class="built_in">export</span> > environment.yml</span><br></pre></td></tr></table></figure></li></ul><p>This creates a <code>.yml</code> file with the current environment’s configuration, which you can then share or use to recreate the environment elsewhere.</p><p>By following these steps, you can easily set up and manage Conda environments using <code>.yml</code> files.</p><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote>]]></content>
<summary type="html"><p>To install a Conda environment from a <code>.yml</code> file, follow these steps:</p>
<h3 id="1-Prepare-the-yml-File"><a href="#1-Prepare</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="PythonNote" scheme="https://discover304.top/categories/NoteBook/PythonNote/"/>
<category term="Python" scheme="https://discover304.top/tags/Python/"/>
<category term="Conda" scheme="https://discover304.top/tags/Conda/"/>
<category term="Environment Management" scheme="https://discover304.top/tags/Environment-Management/"/>
<category term="Tutorial" scheme="https://discover304.top/tags/Tutorial/"/>
</entry>
<entry>
<title>Unlocking the Power of Statistical Analysis With Statsmodels in Python</title>
<link href="https://discover304.top/2024/08/20/2024q3/189-0-statsmodels/"/>
<id>https://discover304.top/2024/08/20/2024q3/189-0-statsmodels/</id>
<published>2024-08-20T13:10:32.000Z</published>
<updated>2024-10-03T17:41:14.779Z</updated>
<content type="html"><![CDATA[<h3 id="Introduction"><a href="#Introduction" class="headerlink" title="Introduction"></a>Introduction</h3><p>In the ever-evolving world of data science, <code>statsmodels</code> stands out as a specialized Python library tailored for statistical analysis and econometric applications. Unlike broader machine learning libraries, <code>statsmodels</code> offers tools designed for in-depth statistical inference, providing insights into the underlying mechanics of data.</p><h3 id="Why-Use-statsmodels"><a href="#Why-Use-statsmodels" class="headerlink" title="Why Use statsmodels?"></a>Why Use statsmodels?</h3><p><code>statsmodels</code> is essential for anyone needing to perform rigorous statistical testing and modeling. It supports a range of statistical models and methods, including:</p><ul><li><strong>Linear and Generalized Linear Models</strong>: For predictive modeling with statistical inference.</li><li><strong>Robust Linear Models</strong>: To mitigate the influence of outliers.</li><li><strong>Time Series Analysis</strong>: Tools for handling data indexed in time sequence.</li></ul><p>Each model in <code>statsmodels</code> is equipped with extensive diagnostic features to validate model assumptions and interpret variable relationships effectively.</p><h3 id="Enhancing-statsmodels-with-Pandas"><a href="#Enhancing-statsmodels-with-Pandas" class="headerlink" title="Enhancing statsmodels with Pandas"></a>Enhancing statsmodels with Pandas</h3><blockquote><p><strong>Enhancement Alert</strong>: Integrating <code>statsmodels</code> with <code>Pandas</code> elevates the user experience by improving data manipulation and readability of output. <code>Pandas</code> DataFrame structures streamline data handling, making statistical analysis more intuitive and accessible.</p></blockquote><h3 id="A-Practical-Walkthrough"><a href="#A-Practical-Walkthrough" class="headerlink" title="A Practical Walkthrough"></a>A Practical Walkthrough</h3><p>To demonstrate the power of <code>statsmodels</code> integrated with <code>Pandas</code>, let’s go through a simple example of linear regression analysis:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line"><span class="keyword">import</span> statsmodels.api <span class="keyword">as</span> sm</span><br><span class="line"></span><br><span class="line"><span class="comment"># Load data into a Pandas DataFrame</span></span><br><span class="line">data = pd.read_csv(<span class="string">'your_data.csv'</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Prepare the model by adding an intercept</span></span><br><span class="line">data[<span class="string">'Intercept'</span>] = <span class="number">1</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Define dependent and independent variables</span></span><br><span class="line">y = data[<span class="string">'Target'</span>]</span><br><span class="line">X = data[[<span class="string">'Intercept'</span>, <span class="string">'Feature1'</span>, <span class="string">'Feature2'</span>]]</span><br><span class="line"></span><br><span class="line"><span class="comment"># Fit an OLS model</span></span><br><span class="line">model = sm.OLS(y, X)</span><br><span class="line">results = model.fit()</span><br><span class="line"></span><br><span class="line"><span class="comment"># Display the summary</span></span><br><span class="line"><span class="built_in">print</span>(results.summary())</span><br></pre></td></tr></table></figure><p>This example highlights how seamlessly <code>statsmodels</code> and <code>Pandas</code> can work together, simplifying the process of fitting a model and interpreting results.</p><h3 id="Conclusion"><a href="#Conclusion" class="headerlink" title="Conclusion"></a>Conclusion</h3><p><code>statsmodels</code> offers a robust platform for statistical analysis, making it an indispensable tool for statisticians, economists, and data scientists. By integrating <code>statsmodels</code> with <code>Pandas</code>, users can leverage powerful statistical techniques alongside superior data management capabilities. For anyone looking to delve deeper into statistical analysis, <code>statsmodels</code> provides the tools necessary to uncover the intricate patterns and relationships within data.</p><h3 id="Explore-More"><a href="#Explore-More" class="headerlink" title="Explore More"></a>Explore More</h3><p>For more detailed information and advanced features, visit the <a href="https://www.statsmodels.org/stable/index.html">official statsmodels documentation</a>. Enhance your analytical skills and transform raw data into meaningful insights with <code>statsmodels</code>.</p><hr><blockquote><p><strong>🍀Afterword🍀</strong><br>The blog focuses on programming, algorithms, robotics, artificial intelligence, mathematics, etc., with a continuous output of high quality.<br><strong>🌸Chat QQ Group</strong>: <a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">Rabbit’s Magic Workshop</a> (942848525)<br><strong>⭐Bilibili Account</strong>: <a href="https://space.bilibili.com/98639326">白拾ShiroX</a> (Active in the knowledge and animation zones)<br><strong>✨GitHub Page</strong>: <a href="https://github.com/YangSierCode000">YangSierCode000</a> (Engineering files)<br><strong>⛳Discord Community</strong>: <a href="https://discord.g/nn5NDXMgae">AierLab</a> (Artificial Intelligence community)</p></blockquote>]]></content>
<summary type="html"><h3 id="Introduction"><a href="#Introduction" class="headerlink" title="Introduction"></a>Introduction</h3><p>In the ever-evolving world of </summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="TechNote" scheme="https://discover304.top/categories/NoteBook/TechNote/"/>
<category term="Python" scheme="https://discover304.top/tags/Python/"/>
<category term="Data Science" scheme="https://discover304.top/tags/Data-Science/"/>
<category term="statsmodels" scheme="https://discover304.top/tags/statsmodels/"/>
<category term="Statistical Analysis" scheme="https://discover304.top/tags/Statistical-Analysis/"/>
</entry>
<entry>
<title>MBZUAI Quick Access Links</title>
<link href="https://discover304.top/2024/08/19/2024q3/draft/188-1-mbzuai-help-link/"/>
<id>https://discover304.top/2024/08/19/2024q3/draft/188-1-mbzuai-help-link/</id>
<published>2024-08-19T15:40:46.000Z</published>
<updated>2024-09-21T13:50:51.419Z</updated>
<content type="html"><![CDATA[<div class="hbe hbe-container" id="hexo-blog-encrypt" data-wpm="密码错误,请重试。" data-whm="抱歉, 这个文章不能被校验, 不过您还是能看看解密后的内容."> <script id="hbeData" type="hbeData" data-hmacdigest="a04f1c95fd234cfd2bf833a941c6eb043ab5bd95e94be4ea5b55970ea7979ff0">d6b2705594faac2605c03c803e14c000213e2f993b3c5b0d3802738d01423e625a95aea05f06b2fe76c209e14bf1c5b28fad21b853d8fefa0a867e0640f83b28283c9fbf207127de62dbcbc2c7031d34b1df0312224229cc772cb86089963b977e4ce90a618fca58ca41b1a48f6da3e9c62976261fd4f1cd5f49fb57e382d444f52e53438fbc71c9ce30d962d712d5d4e10b7de6376d87428b1d2f6ace8eb89cadc6734dd5774a1cdb3e7612b5490c393f02a806db0b5f7f287455f1c9683abbb6b872a6ca4767fd01b4122e933d5720823cd7fe375857e50945d733b928ec3b83dade5cdd79ea2c4f78d3789f2f777d1887b882a29c96b7caebf6e0f720111afa261dfce49404a658258e044fb913301a3f18683b57c93f2ea1afa04e30514e092c4789ab7f586ca4502416db0a16be882d37cfaaa208851605cb5aed718efa583d844e58787973819b9d5da9f246dd80d69c102d36ff36e700711e371a9e41c893189554fd6148736250887b3ab4438c8b88cf615fbbdf02877229b34b0a8972d9e6fc910100322e945435452e66fda73e1bfae3dc287b1a7019435752823e2c0517e6ca1e04a5be12c67da961e1e935d1ddf4e877c92411989449fde87d56bbddee1dfb20ee318bc2b93fa7b8ba456cb238499be216d81468e31168e02f637267b6ee63274bc830c2b7d54f2aa250abaf77abb1e5903ab219c292b4497ecad739a380cc2a063c947b80e28e349359839980a092836227268c73e12506ec15b1bcedbf6f0151fd5e8d0db6a43a86694621da36e81a0ce62bc88eb23459ffb9c38d1dfc0c7a46029948a48068535d9e61ac86994927816f691fd7f40d7ddb0198282e28b64f49bd68b9ba4d5ac5dc50b894e2f84998923bbfe4db86581a1cc230860bfbeca840e2b7208d9722ecd8a621fe78402b306592d47f89c43a460c54864a04f5f8bec1938ea3ddc3ca46746f7d417fb555fcd455a96bd26fcffb00b412539996d445aa79156d2cf85fc50889121a7ae997d6480e50bcf0f2c7dcc4bf00a5dbfe8eedb66c68c4d95e2b765af0600dfbb321b563b8a44cfc7e8c20755b74ed03445ee4d6b28e7f43597d72fd694fc96c7ff1d4a435f6278131dbb7924b72df8766b763bb8c966458e2845722d18ea4accc3b8206f4668e7592b2d406d38c954234cdf34adb775ba18b4d1e9ebea09fafd2f4765de8f8dd86949c97751d6d526d564e866924babe4e8455489e3b2b9948a88cf401af512550c2dd1b103fdd48a8f894b2c4e6555bc9554b07720545b1b475db37af21cc694fe2c290853fe3a5028590eafdc7c0e67482d4496196e98d7b66cc6d62c79b92c1a826d13f895b035caee6c75943ff24ac9f11ca9732f8a9e96e1416adb495d2a34474618f9f9b8b2a75c8f0de8adea52743b7833834c3749d1668671aaa27de8c6ad083466d7da1fc9568a88ee799ae7b8e07c62beee084bb6ba05b71018f89d0ba28ee01ac854dbf1569bf109888101d956b9e0e72aa111f57b47b1a7c945923dacbbd4d1d95d6b704e9571f842ac9b826a1ac00bd107af60543b167b26ea02b3c1cdda43171736edc681a90e2a69d54cbf347cd3bc00a5d437c22b57b89328b457b677bf9d09db2801dc83592d773f08013d3c29244f673236dd62dca06baf8431ed08907e591deae5462ac5fc3eae75f1226344ed912060e47be60fa092270ceef48f85e9d929ac00fc9c6875153f32629282996329be62639dbdf59bec864aec6b8c9f9786db36296914a4a2cafbf1dedbe982f3486dd8969a8a369f9408a71fc67062883c99b68b3d298b2ef468d8771e311813df050c4dc8d92aa76305190a06837461937fc73cd51299a915d5fd9fe6428fa2b31a78529cb7431ee8e4beba948efa134b70ee07373832224924322adf6793e2b60ee15814acb910f672a7070ace75e2b5c01a171b8796932e047e5bb231406b87d965f69d49375b567ca32f39835ddfd7bea4ef797c623a2c9d70fab9414fdb303867a6fdc2d0fd1fd553cf72c8b7e3629da68fff0374ba749d313faa4a3ce4f9f0758cf0483e92d5518819b364c76100295363393aaef9ade5db39f92493312f54c06c3910142a6fb74659e0a656341d69d21799341bc0802dd574be750dbf46e783d8cae286f94acb477f008cb366eca816b0332d5f4ea71208ec45bfeccff3d123f83a5582d8434e911011cad6a187947cffcfc271e853d42d3768ea1a5d20890a0bee2674886bb92f3baf0433cefe0cd77311be945b600af78e021f312a203ed88cff3cadac7dd1418addc700fc547b5c919de6219471e1c32d3a905c9178c9e002d7250f38ef48ff9589a871302e4232407182b18af97ece58f6d5aa753e812d699ed6722c48b64832e3b6219d4803f227ae4598f91bf61f4aff7e9cb9f51ba7608ab29d5f482e1161504546a3370b59bea359fa37bb05700a1d599a5b6a122c183841df8bc1a88ce8fbb258e57aa15ad0f1a929e086aa0db21737cb318bfb045d097cced23347b98d2d808754c5f9218093df071ec7b1f58349854fd1bf77fc9bd67cd289a2bbdb8145b470be7b0554d44a9f1adae832a1ca871509e730e6ee041fd2fc47c92ac7dc7abf8977aa0170d7ed42e708508ff0504fef90962d0f608020d7f4e21c4a4fa94f6f0f1c0774d7a885ce87e0702cfc711dbea43ef8103049d396f8f14bb82b7336d038806625a59460ada43572eeb234deaca97b9a850f0718b663fb160134160acd42610d3cca7c18563060325d166eb2d6b7438e8163ad81c19ba687aa5b9fd17e19c8184df470ea37b8919d9d21c1fb88814d220107de0aa7444344401c4c72e6d70f359e376a5eed5de5cb68ba8c2ddc0162c3617b80a6d50d4bbb7f88e70c9630f65d2b98a7f3a622e2b4837f9e47d00d8653d01c76dbc3c3a4276e7dc4cb85598272410a7aa9afbdd1d2890bb938e70c685b1040f252c480eb38dad9463c7ee8305094bd6dde76fb099c4ee4135154067b3f6a3a4201b6e2c2193907e687bbaaf8574c9785019adb22417f8ec0ab19f446ef37ee008eb98118dd685607e710a92995b6c6035577db0279d7e2bf75d11baa3df0722519144e61c7c5ba20f52173b8d39e98b84993ff56a8212fc58652d6e90aafed6570d8b69147bc3c8ee87761001312d5ae18ecc3a0915baa69c8be73bc85b37e2df17fd174c607f2e1e69a8b89ca2751c2ade86af790b0eed480f10b53979754f65ed5c50eca38ee76f4bc88ad18b89ac214192bb291e2e0392ea5101c7f15691ff30d08c4f6132c6fd592353d8eb72a110ff951bca975aac76e62a5727e47d63b8676c98af939f84f8f3d51191f17466c51fbb6efaf91730f2248577787b3a93880af5966985130000379370b2e1c853da54ad8af0d8200ae5b5187e648b005f405a2cf63d475cfb9c02763c1b0084d8c85cc8b7e9eb28383fc5c2fed002c07d36a01396d130c5f3d3b7626511ba11f51f5b29b0457ec341fdfb78b6f23858ec6c195201a75e031675c36178c0617f8f1b61ea83b1c9e08efaad7243077789ad246854c937b8ce2462d7978b1db68425e4e66ac9ce3df656332c06bf68f904986bcef7a6e9e8692e22f60fc9db46298f762fe5bd2e7e28e198295b38545d80a2741cad5cf0e2f296fd3128d5b515f1359d1f8ae7b5ee83f528078ba3733dc749d95adf78433d49eb9ed61665260fc8fdf18ff683cabf982e8a1e08e05c62302e60e0da6d177bc9e597474879b4ba3b81ca275098f83b50296307bc116dea0304ff8fa321db5d4505d3e4b0f262a8cac14a98fe641c35cd9af3f8cf53f9c602f856534caf7ccfc56a779dc335f7ef955e9979d1eaf4971bb1e191163b78795fed51d959da346e7186280ed905194277f71696e989be61f18ba0089e5011a7216c3f01fe078cd52b8b52e219cb979ce54da1ab1b705239e8d08cd03598d0eca8987af8021f92a949be4d52c794e6100e884dcbdfd0185c2df512dbb1c5693f3bb78c1b366893687d2bbb16be6e385d6795596b7fe3e4d3869fa499836fd9d6d471f589181600698ef5d78bb1d00dca26264c66377d8e2dea7f027cf6a3eae7af9ace7f9e1a1478ffd508c2f1b0b79c491b87146c25f58a5fa1781e72e0ba510158f308bf08dec3154311249d3dd0f2153fe456e240202ff77b61ab85779a07cbbc1c7bac1c2cdf1fed5350a0a3bf2fae13ded1e4ed68d9108a290d67d91338df0d82bcffade59975b3dab05f0e393eb6b8c04e0dba00e4c86d4488539cb9ae1acfb3f26885e069f617f1af28e5f465c16671e79b4bf1c7c3e6cfc0092688470642d54625bdf91d4a9779f52134edab44055a631066c78f38f94189d51c09c0fa337963d91a3cffcdf8315b118633741432e0f25a41bf3ece97eda8852ba5ce8e72a41248ca7a72203127c6085da7305d114aa5a3d7951a720ea59768238058f2938e46fb529f55d1527ded72753e037308fde31807f0fa0882bc7c1bf9935f4a7f998ac2ffcff53992175981f36d79786b795e235d3c2b39fa9344e7ae30a8534753fdb6ad5ea4ef20cdc0cd93cbaf673731145c2fd44c573b41637048ca14be14ae06a1ec79b4b443cee400fa3ab696c701cb7ed9f310aa7f3a6485f4360b54699882fe880cad7653e2cdd5f090e343d0437fa4d3a80d287e217f2126ecfd196791eb8e2d8784615f4668e74fb8967474e7d0304ab38d07b226fe79b85b63099d82a50a2bd4282af7b50faecfabd06354007623bd830dc3f0427522504b8acdd7be70a13674d95c9e3aa479cf517b035088b49f13eb832e5e14c47de91390627d1d8bb538bd1b17796d27babf256cf0ec5e3fa49078bd4f7ba2accb1bb582e5a395aa802ae6915f02f4db82e6ec780b2c90bdcce33d8dd79610ca7205aa4e32dd3fe3c17fdf5f46d1fad3a78a691cb307f743192a3771ab676291bacabb1da644e6e243be4e2cd56d9f6f4b44bfdbe9e83040cfc66df33ceae1e818c96066241f7ecfc02fd7e47c0e5394549bb394957c04a5558069652fe802dfd54c956852abb7306f19fad63b7381068fdce52d63291fdc317b6846a5de8596f6c552bd482d657e6a3eb0522c3a753afae049a5fd33af71e7a8325748bee3ea79da4864efb98cec5d66037539c0435aa22aa1cdf9d1a6d115c8f5802563e10bedfbdf5f66687bfce63dc563394acfb8e52efdbcad0ab9b6cdbd9ede680bc60edc35c7b94fe5c498c0c78eeb4f8750ce8754694721dddad614a4ff1eeb7d89617d3f92a5c388a1e1cf5a50bd8a83609d9552f7d5470c263eea24beafb0cc9fc5ea446698fc9f4aa4f56cfb357ee8e6f9e23c434ecd863b3edddb64e47c7efd68b37c884ba4134b5158e202d1a473844c041ce783bbbec54a4c858e2c9a6206cca223175ea1eaf5b0555b0de4de9639a74a19629caee249dc68b913ce9fa622e463c4c7a3ff98d2510efae00961616591c0ad10488354cf22bbe65ea17c78b068b00c1e92b8edc47288a4ac8c92a66da36a5d01f87f34bd292eac50343989136b6d7c3795d90d23339b433ff27f163829508d4904390009820c20082d70f46650573b33e547218b9285e0ae4063e10f982adad8357bb02bcf14416fa270e253bfd1257cadb3d3e4101d003a49482d4fbffc54435d0e4ff90f644147a6200da5277f889473203805afee5d480f4f0b1f350cf7bb3cbd6bdcd673042c80a4cc0964ff821894767805bcbb3e0df1b8082472dd55c88d5308f4c544597d6bba40dddef3ada0d5eb15e7a93a726f0175f0e42a2caf83ee32c7ffa9b6d872d1028a6369b57c69f68acd02879304bc2151472f19c89694378bad7429292f9025a54f40139319e09bff11b058a66518a05d2600b36e622b0dc51fbd9bf9f80f4992111d014b9d1bd78565adf185f8832e0e445211c5a54158165df3dae5ca221bcc580eb5dbf1db909bd42590551dd8fb707258d70a27810395a857228b9d67513a2ee45d55e914396cfc7896286f25da5a07cf6a7ab2eee970e2c104f4d48d7f978556f8b6bd028cb942b00fc4d05e6a0921da710c06ad5d046798a4fe2a07d94c200b016ed790bdc40fe8d4d0e3c6c036f62783633c6a45eb76efef097882b8b9842e6a32b9f9f88fa96686acc9ae663d10c1916e65ff93c095ebe0a1e395a4001c864ba4f0f26d532f5920c209de615306e1582f920a3fa7be266a8a7118f1c76d76aa0e96de5db5640da98671fb10e062eb40515ddc20480ed0eaf5cc341f4ecbf6b3398f9b446b87f1a6cfcd5f60e542e157b265e9bce7af33c010179686770e6f1b7cbb175e25f3b3ba878ed0e8b015a46121ee28eb1a9f07568383ab39f70fabf4c059cc422b89d4fe7811a6e3583004f34bd4f1a1b38c5d4bd042479836d411b7fdf25d7a3398c8389422df1b17bb2f48eacdeeec50cf282f63294727e5221751fe93845ffdfedbe3e3842cec2a227bee34f8616e2a391967f188022f75369069226dfebb445976251cec85861fde35e82b8287cf42e1419942c9766d7aaadeb9ee6065171e09533ceb45c15dd31267e1899ca2c863c27d41d83a9ec974f98bdf804ec22998df32ff6dc9008840a8e1801b8bc3ee528fcd19c92868d351472a193708533196e9e2fb48aabfbe959da5083566f4813bfd2e0112e765e163e0bec3c1f9621c40083caf19c1af7f9064cbbc343f232fdecfd22e36aaa295749f46306bc8bc5b0e8805a351a67681893fc953cf5ff533c044e0429944a7d1560bdad3390589a15898ebab3cf967bcc3484732a202395ac5c019240d1ae922637c2f349b7960663a5543c465380d0eb1e985f43a78d10d26af2aa609641fe4133d31d98b73c4bd1a6785d0160dcb52902830e63289bb4931d19ef7bb5f98b03501881002a82c0ba8e8108b576a54558d2d56728eddde0137d0dee1e6b9b22680873589ac143169565393594048f5b555feaf56cfa86dceda61e4dd6c71e3824fcea59a4b73087ee58f36aa19be084b8b70d2731b3cce9a3c350d824148cad46d2eb6a08f2ed6e4d51df141c8ad26fa67e82211d298</script> <div class="hbe hbe-content"> <div class="hbe hbe-input hbe-input-blink"> <input class="hbe hbe-input-field hbe-input-field-blink" type="password" id="hbePass"> <label class="hbe hbe-input-label hbe-input-label-blink" for="hbePass"> <span class="hbe hbe-input-label-content hbe-input-label-content-blink" data-content="请输入密码,访问当前内容。">请输入密码,访问当前内容。</span> </label> </div> </div></div><script data-pjax src="/lib/hbe.js"></script><link href="/css/hbe.style.css" rel="stylesheet" type="text/css">]]></content>
<summary type="html">这里有东西被加密了,点击输入密码查看哦。</summary>
<category term="Draft" scheme="https://discover304.top/categories/Draft/"/>
<category term="合作" scheme="https://discover304.top/tags/%E5%90%88%E4%BD%9C/"/>
</entry>
<entry>
<title>Maximizing Efficiency With MBZUAI HPC: A Guide to SSH, Slurm, and Tmux</title>
<link href="https://discover304.top/2024/08/19/2024q3/188-0-mbzuai-instruction/"/>
<id>https://discover304.top/2024/08/19/2024q3/188-0-mbzuai-instruction/</id>
<published>2024-08-19T14:21:21.000Z</published>
<updated>2024-08-20T18:07:21.840Z</updated>
<content type="html"><![CDATA[<div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li class="tab"><button type="button" data-href="#-2">中文版本</button></li></ul><div class="tab-contents"><div class="tab-item-content active" id="-1"><p>Working on high-performance computing (HPC) systems requires a solid understanding of the tools and processes that enable efficient resource management. This guide covers essential steps to access the MBZUAI HPC environment using SSH, manage jobs with Slurm, and maintain persistent sessions with Tmux. Whether you’re a beginner or looking to refine your skills, this blog post will help you get the most out of your HPC experience.</p><h2 id="1-Quick-Access-Links"><a href="#1-Quick-Access-Links" class="headerlink" title="1. Quick Access Links"></a>1. Quick Access Links</h2><p>Before diving into the technical details, make sure you have easy access to these essential resources:</p><ul><li><a href="https://computinglabswiki.mbzuai.ac.ae/">Computing Labs Wiki</a></li></ul><h2 id="2-HPC-Access-via-SSH"><a href="#2-HPC-Access-via-SSH" class="headerlink" title="2. HPC Access via SSH"></a>2. HPC Access via SSH</h2><p>To access the MBZUAI HPC, you’ll need to use SSH. Below is the configuration for accessing the lab workstation:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Host MBZUAI_lab_workstation</span><br><span class="line"> HostName login-student-lab.mbzu.ae</span><br><span class="line"> User haobo.yang</span><br></pre></td></tr></table></figure><h2 id="3-Managing-Resources-with-Slurm"><a href="#3-Managing-Resources-with-Slurm" class="headerlink" title="3. Managing Resources with Slurm"></a>3. Managing Resources with Slurm</h2><p>Slurm is a powerful workload manager that helps allocate and manage computing resources on HPC systems. Here are some key commands to get you started:</p><h3 id="3-1-Viewing-Partition-and-Node-Information"><a href="#3-1-Viewing-Partition-and-Node-Information" class="headerlink" title="3.1. Viewing Partition and Node Information"></a>3.1. Viewing Partition and Node Information</h3><p>To see the available partitions and nodes, use the following command:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sinfo</span><br></pre></td></tr></table></figure><h3 id="3-2-Viewing-Job-and-Job-Step-Information"><a href="#3-2-Viewing-Job-and-Job-Step-Information" class="headerlink" title="3.2. Viewing Job and Job Step Information"></a>3.2. Viewing Job and Job Step Information</h3><p>To view all jobs or your specific jobs, use:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">squeue</span><br></pre></td></tr></table></figure><p>For only your jobs, add the <code>--me</code> flag:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">squeue --me</span><br></pre></td></tr></table></figure><h3 id="3-3-Allocating-Resources"><a href="#3-3-Allocating-Resources" class="headerlink" title="3.3. Allocating Resources"></a>3.3. Allocating Resources</h3><p>You can allocate resources by requesting a set of nodes and processors. For example:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">salloc -N1 -n24</span><br></pre></td></tr></table></figure><p>To allocate a specific workstation:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">salloc -w ws-l6-007</span><br></pre></td></tr></table></figure><h2 id="4-Managing-Persistent-Sessions-with-Tmux"><a href="#4-Managing-Persistent-Sessions-with-Tmux" class="headerlink" title="4. Managing Persistent Sessions with Tmux"></a>4. Managing Persistent Sessions with Tmux</h2><p>Tmux is an essential tool for anyone working on long-running tasks or multiple sessions in an HPC environment. With Tmux, your sessions remain active even if you disconnect, ensuring that your tasks continue uninterrupted.</p><h3 id="4-1-Starting-a-Tmux-Session"><a href="#4-1-Starting-a-Tmux-Session" class="headerlink" title="4.1. Starting a Tmux Session"></a>4.1. Starting a Tmux Session</h3><p>To start a basic Tmux session, simply type:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux</span><br></pre></td></tr></table></figure><h3 id="4-2-Creating-Named-Tmux-Sessions"><a href="#4-2-Creating-Named-Tmux-Sessions" class="headerlink" title="4.2. Creating Named Tmux Sessions"></a>4.2. Creating Named Tmux Sessions</h3><p>If you manage multiple Tmux sessions, it’s useful to name them. Start a new named session like this:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux new -s session_name</span><br></pre></td></tr></table></figure><h3 id="4-3-Detaching-from-a-Tmux-Session"><a href="#4-3-Detaching-from-a-Tmux-Session" class="headerlink" title="4.3. Detaching from a Tmux Session"></a>4.3. Detaching from a Tmux Session</h3><p>You can temporarily leave a Tmux session by detaching from it with:</p><p><kbd>Ctrl</kbd> + <kbd>b</kbd> then <kbd>d</kbd></p><p>This allows your processes to continue running in the background.</p><h3 id="4-4-Re-attaching-to-a-Tmux-Session"><a href="#4-4-Re-attaching-to-a-Tmux-Session" class="headerlink" title="4.4. Re-attaching to a Tmux Session"></a>4.4. Re-attaching to a Tmux Session</h3><p>To reconnect to a Tmux session, first list all running sessions:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux <span class="built_in">ls</span></span><br></pre></td></tr></table></figure><p>Identify the session name from the list and re-attach using:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux attach-session -t session_name</span><br></pre></td></tr></table></figure><p>For example, to re-attach to a session named <code>0</code>:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux attach-session -t 0</span><br></pre></td></tr></table></figure><h2 id="5-Conclusion"><a href="#5-Conclusion" class="headerlink" title="5. Conclusion"></a>5. Conclusion</h2><p>Leveraging SSH, Slurm, and Tmux effectively can significantly improve your productivity and resource management on the MBZUAI HPC. With these tools, you can confidently manage your jobs, maintain persistent sessions, and ensure that your computational tasks are running smoothly, even in your absence.</p><h2 id="6-Additional-Info"><a href="#6-Additional-Info" class="headerlink" title="6. Additional Info"></a>6. Additional Info</h2><p>The terminal command activate code.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">(base) 127 ws-l1-007:~ $</span><br><span class="line">module load VSCODE</span><br><span class="line">(base) 0 ws-l1-007:~ $</span><br><span class="line">code</span><br><span class="line">(base) 0 ws-l1-007:~ $</span><br></pre></td></tr></table></figure><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div><div class="tab-item-content" id="-2"><p>在高性能计算(HPC)系统上工作需要对工具和流程有一个清晰的理解,以便有效地管理资源。本指南涵盖了使用SSH访问MBZUAI HPC环境、使用Slurm管理作业以及使用Tmux保持持久会话的关键步骤。无论你是初学者还是希望精进技能,这篇博文都将帮助你充分利用HPC的体验。</p><h2 id="1-快速访问链接"><a href="#1-快速访问链接" class="headerlink" title="1. 快速访问链接"></a>1. 快速访问链接</h2><p>在深入技术细节之前,请确保你可以轻松访问这些重要资源:</p><ul><li><a href="https://computinglabswiki.mbzuai.ac.ae/">计算实验室Wiki</a></li></ul><h2 id="2-通过SSH访问HPC"><a href="#2-通过SSH访问HPC" class="headerlink" title="2. 通过SSH访问HPC"></a>2. 通过SSH访问HPC</h2><p>要访问MBZUAI HPC,你需要使用SSH。以下是访问实验室工作站的配置:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Host MBZUAI_lab_workstation</span><br><span class="line"> HostName login-student-lab.mbzu.ae</span><br><span class="line"> User haobo.yang</span><br></pre></td></tr></table></figure><h2 id="3-使用Slurm管理资源"><a href="#3-使用Slurm管理资源" class="headerlink" title="3. 使用Slurm管理资源"></a>3. 使用Slurm管理资源</h2><p>Slurm是一个强大的工作负载管理器,帮助分配和管理HPC系统上的计算资源。以下是一些关键命令,帮助你入门:</p><h3 id="3-1-查看分区和节点信息"><a href="#3-1-查看分区和节点信息" class="headerlink" title="3.1. 查看分区和节点信息"></a>3.1. 查看分区和节点信息</h3><p>要查看可用的分区和节点,请使用以下命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sinfo</span><br></pre></td></tr></table></figure><h3 id="3-2-查看作业和作业步骤信息"><a href="#3-2-查看作业和作业步骤信息" class="headerlink" title="3.2. 查看作业和作业步骤信息"></a>3.2. 查看作业和作业步骤信息</h3><p>要查看所有作业或特定作业,请使用:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">squeue</span><br></pre></td></tr></table></figure><p>如果只查看你自己的作业,添加 <code>--me</code> 参数:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">squeue --me</span><br></pre></td></tr></table></figure><h3 id="3-3-分配资源"><a href="#3-3-分配资源" class="headerlink" title="3.3. 分配资源"></a>3.3. 分配资源</h3><p>你可以通过请求一组节点和处理器来分配资源。例如:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">salloc -N1 -n24</span><br></pre></td></tr></table></figure><p>要分配一个特定的工作站:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">salloc -w ws-l6-007</span><br></pre></td></tr></table></figure><h2 id="4-使用Tmux管理持久会话"><a href="#4-使用Tmux管理持久会话" class="headerlink" title="4. 使用Tmux管理持久会话"></a>4. 使用Tmux管理持久会话</h2><p>Tmux是一个对任何在HPC环境中进行长时间任务或管理多个会话的人来说非常重要的工具。通过Tmux,即使你断开连接,你的会话也会继续保持活动状态,确保你的任务不间断地运行。</p><h3 id="4-1-启动Tmux会话"><a href="#4-1-启动Tmux会话" class="headerlink" title="4.1. 启动Tmux会话"></a>4.1. 启动Tmux会话</h3><p>要启动一个基本的Tmux会话,只需键入:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux</span><br></pre></td></tr></table></figure><h3 id="4-2-创建命名Tmux会话"><a href="#4-2-创建命名Tmux会话" class="headerlink" title="4.2. 创建命名Tmux会话"></a>4.2. 创建命名Tmux会话</h3><p>如果你需要管理多个Tmux会话,命名它们是很有用的。以以下方式启动一个新的命名会话:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux new -s session_name</span><br></pre></td></tr></table></figure><h3 id="4-3-从Tmux会话中分离"><a href="#4-3-从Tmux会话中分离" class="headerlink" title="4.3. 从Tmux会话中分离"></a>4.3. 从Tmux会话中分离</h3><p>你可以通过以下方式暂时离开一个Tmux会话:</p><p><kbd>Ctrl</kbd> + <kbd>b</kbd> 然后 <kbd>d</kbd></p><p>这允许你的进程在后台继续运行。</p><h3 id="4-4-重新连接到Tmux会话"><a href="#4-4-重新连接到Tmux会话" class="headerlink" title="4.4. 重新连接到Tmux会话"></a>4.4. 重新连接到Tmux会话</h3><p>要重新连接到Tmux会话,首先列出所有正在运行的会话:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux <span class="built_in">ls</span></span><br></pre></td></tr></table></figure><p>从列表中识别会话名称并使用以下命令重新连接:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux attach-session -t session_name</span><br></pre></td></tr></table></figure><p>例如,要重新连接到名为 <code>0</code> 的会话:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tmux attach-session -t 0</span><br></pre></td></tr></table></figure><h2 id="5-结论"><a href="#5-结论" class="headerlink" title="5. 结论"></a>5. 结论</h2><p>有效利用SSH、Slurm和Tmux可以显著提高你在MBZUAI HPC上的生产力和资源管理能力。通过这些工具,你可以自信地管理作业,保持持久会话,并确保你的计算任务即使在你不在时也能顺利运行。</p><h2 id="6-补充说明"><a href="#6-补充说明" class="headerlink" title="6. 补充说明"></a>6. 补充说明</h2><p>The terminal command activate code.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">(base) 127 ws-l1-007:~ $</span><br><span class="line">module load VSCODE</span><br><span class="line">(base) 0 ws-l1-007:~ $</span><br><span class="line">code</span><br><span class="line">(base) 0 ws-l1-007:~ $</span><br></pre></td></tr></table></figure><button type="button" class="tab-to-top" aria-label="scroll to top"><i class="fas fa-arrow-up"></i></button></div></div></div><hr><blockquote><p><strong>🍀后记🍀</strong><br>博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。<br><strong>🌸唠嗑QQ群</strong>:<a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">兔叽の魔术工房</a> (942848525)<br><strong>⭐B站账号</strong>:<a href="https://space.bilibili.com/98639326">白拾Official</a>(活跃于知识区和动画区)<br><strong>✨GitHub主页</strong>:<a href="https://github.com/YangSierCode000">YangSierCode000</a>(工程文件)<br><strong>⛳Discord社区</strong>:<a href="https://discord.g/nn5NDXMgae">AierLab</a>(人工智能社区)</p></blockquote>]]></content>
<summary type="html"><div class="tabs" id=""><ul class="nav-tabs"><li class="tab active"><button type="button" data-href="#-1">English Version</button></li><li c</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="TechNote" scheme="https://discover304.top/categories/NoteBook/TechNote/"/>
<category term="HPC" scheme="https://discover304.top/tags/HPC/"/>
<category term="SSH" scheme="https://discover304.top/tags/SSH/"/>
<category term="Slurm" scheme="https://discover304.top/tags/Slurm/"/>
<category term="Tmux" scheme="https://discover304.top/tags/Tmux/"/>
<category term="Resource Management" scheme="https://discover304.top/tags/Resource-Management/"/>
</entry>
<entry>
<title>【课题】Decifer音乐项目与LLM Repo Eval项目</title>
<link href="https://discover304.top/2024/07/02/2024q3/187-music-x-lab-other-research/"/>
<id>https://discover304.top/2024/07/02/2024q3/187-music-x-lab-other-research/</id>
<published>2024-07-01T21:58:10.000Z</published>
<updated>2024-08-20T17:45:11.914Z</updated>
<content type="html"><![CDATA[<blockquote><p>注:AI 整理,仅作参考</p></blockquote><h2 id="1-Decifer音乐生成项目"><a href="#1-Decifer音乐生成项目" class="headerlink" title="1. Decifer音乐生成项目"></a>1. Decifer音乐生成项目</h2><h3 id="1-1-项目概述"><a href="#1-1-项目概述" class="headerlink" title="1.1. 项目概述"></a>1.1. 项目概述</h3><p>Decifer项目致力于开发一个利用音频语言模型(Y)指导MIDI语言模型(X)的跨模态音乐生成模型。</p><h3 id="1-2-技术细节"><a href="#1-2-技术细节" class="headerlink" title="1.2. 技术细节"></a>1.2. 技术细节</h3><ul><li><strong>数据收集</strong>:收集大量的MIDI和相应的音频数据。</li><li><strong>模型蒸馏</strong>:音频模型作为导师模型,将知识传递给MIDI模型。</li><li><strong>跨模态学习</strong>:实现音频输出到MIDI输入的映射,促进两个模型的互动学习。</li></ul><h2 id="2-LLM-Repo-Eval项目:GitHub仓库评估"><a href="#2-LLM-Repo-Eval项目:GitHub仓库评估" class="headerlink" title="2. LLM Repo Eval项目:GitHub仓库评估"></a>2. LLM Repo Eval项目:GitHub仓库评估</h2><h3 id="2-1-项目目标"><a href="#2-1-项目目标" class="headerlink" title="2.1. 项目目标"></a>2.1. 项目目标</h3><p>利用大型语言模型评估GitHub仓库的效率、资源开销、部署或开发难易程度。</p><h3 id="2-2-实施步骤"><a href="#2-2-实施步骤" class="headerlink" title="2.2. 实施步骤"></a>2.2. 实施步骤</h3><ul><li><strong>确定评估标准</strong>:包括代码质量、工程质量、使用体验、部署和配置等。</li><li><strong>设计评估工具和方法</strong>:选择合适的代码分析和性能分析工具。</li><li><strong>收集数据</strong>:运行和测试GitHub仓库,收集性能数据和用户反馈。</li><li><strong>数据分析</strong>:分析收集到的数据,评估GitHub仓库的综合表现。</li></ul><h2 id="3-总结"><a href="#3-总结" class="headerlink" title="3. 总结"></a>3. 总结</h2><p>这两个项目通过使用先进的AI技术解决特定领域问题,展示了AI在音乐生成和软件工程质量评估中的应用潜力。</p><hr><blockquote><p><strong>🍀后记🍀</strong><br>博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。<br><strong>🌸唠嗑QQ群</strong>:<a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">兔叽の魔术工房</a> (942848525)<br><strong>⭐B站账号</strong>:<a href="https://space.bilibili.com/98639326">白拾Official</a>(活跃于知识区和动画区)<br><strong>✨GitHub主页</strong>:<a href="https://github.com/YangSierCode000">YangSierCode000</a>(工程文件)<br><strong>⛳Discord社区</strong>:<a href="https://discord.g/nn5NDXMgae">AierLab</a>(人工智能社区)</p></blockquote>]]></content>
<summary type="html"><blockquote>
<p>注:AI 整理,仅作参考</p>
</blockquote>
<h2 id="1-Decifer音乐生成项目"><a href="#1-Decifer音乐生成项目" class="headerlink" title="1. Decifer音乐生成项</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="TechNote" scheme="https://discover304.top/categories/NoteBook/TechNote/"/>
<category term="AI" scheme="https://discover304.top/tags/AI/"/>
<category term="Music Generation" scheme="https://discover304.top/tags/Music-Generation/"/>
<category term="Cross-modal Learning" scheme="https://discover304.top/tags/Cross-modal-Learning/"/>
<category term="Large Language Models" scheme="https://discover304.top/tags/Large-Language-Models/"/>
<category term="GitHub Evaluation" scheme="https://discover304.top/tags/GitHub-Evaluation/"/>
</entry>
<entry>
<title>The Role of Vector Stores in Similarity Search and Indexing</title>
<link href="https://discover304.top/2024/06/29/2024q2/186-vs/"/>
<id>https://discover304.top/2024/06/29/2024q2/186-vs/</id>
<published>2024-06-29T14:39:55.000Z</published>
<updated>2024-08-20T17:54:47.891Z</updated>
<content type="html"><![CDATA[<h2 id="what-is-the-purpose-to-have-vector-store-for-similarity-check-and-indexing-the-relevant-context-material"><a href="#what-is-the-purpose-to-have-vector-store-for-similarity-check-and-indexing-the-relevant-context-material" class="headerlink" title="what is the purpose to have vector store? for similarity check and indexing the relevant context material?"></a>what is the purpose to have vector store? for similarity check and indexing the relevant context material?</h2><p>A vector store is primarily used for efficiently managing and querying vector data, which is essential for tasks such as similarity checks and indexing relevant context material. Here are the key purposes of having a vector store:</p><ol><li><p><strong>Similarity Search</strong>:</p><ul><li><strong>Efficient Retrieval</strong>: When dealing with high-dimensional data such as word embeddings, image embeddings, or other feature vectors, vector stores allow for efficient similarity searches. This is crucial for applications like recommendation systems, image recognition, and natural language processing, where finding similar items quickly is essential.</li><li><strong>Distance Metrics</strong>: Vector stores typically support various distance metrics (e.g., cosine similarity, Euclidean distance) to measure the similarity between vectors, enabling the retrieval of the most relevant items based on their vector representations.</li></ul></li><li><p><strong>Indexing Relevant Context Material</strong>:</p><ul><li><strong>Contextual Search</strong>: By indexing vectors, a vector store allows for quick retrieval of contextually relevant information. For example, in a document retrieval system, sentences or paragraphs can be converted into vectors and stored, making it possible to fetch the most relevant context based on a query vector.</li><li><strong>Scalability</strong>: Vector stores are designed to handle large volumes of vector data, supporting scalability in applications that require processing and searching through vast amounts of information.</li></ul></li><li><p><strong>Integration with Machine Learning Models</strong>:</p><ul><li><strong>Embedding Management</strong>: Many machine learning models, particularly in NLP and computer vision, generate embeddings that represent data points in a high-dimensional space. A vector store provides a structured way to store and manage these embeddings.</li><li><strong>Inference and Real-time Applications</strong>: In real-time applications such as chatbots or voice assistants, vector stores enable rapid retrieval of relevant responses or actions based on the embeddings of user queries.</li></ul></li><li><p><strong>Optimization for Query Performance</strong>:</p><ul><li><strong>Index Structures</strong>: Vector stores use specialized index structures like KD-Trees, Ball Trees, or more advanced methods like HNSW (Hierarchical Navigable Small World graphs) to optimize the performance of nearest neighbor searches.</li><li><strong>Approximate Nearest Neighbor (ANN) Search</strong>: To further enhance performance, vector stores often implement ANN algorithms, which provide faster results with a trade-off of some approximation, suitable for large-scale and real-time systems.</li></ul></li><li><p><strong>Data Management and Versioning</strong>:</p><ul><li><strong>Update and Maintain Vectors</strong>: Vector stores often include functionalities for updating and maintaining vector data, which is essential as the underlying data or the models generating the embeddings evolve.</li><li><strong>Version Control</strong>: Some vector stores support versioning of vectors, allowing for tracking changes and maintaining consistency across different versions of the data.</li></ul></li></ol><p>Overall, vector stores are vital for handling the complexities associated with high-dimensional vector data, providing the infrastructure needed for efficient similarity searches, contextual indexing, and integration with various machine learning workflows.</p><h2 id="what-is-the-purpose-to-have-vector-store-for-chatgpt"><a href="#what-is-the-purpose-to-have-vector-store-for-chatgpt" class="headerlink" title="what is the purpose to have vector store for chatgpt?"></a>what is the purpose to have vector store for chatgpt?</h2><p>The purpose of having a vector store for ChatGPT or similar AI models is to enhance the retrieval of relevant information and improve the model’s performance in several ways:</p><h3 id="1-Efficient-Information-Retrieval"><a href="#1-Efficient-Information-Retrieval" class="headerlink" title="1. Efficient Information Retrieval"></a>1. Efficient Information Retrieval</h3><p>A vector store allows for efficient retrieval of relevant documents or data points based on their semantic similarity. Instead of relying solely on keyword matching, vectors capture the meaning of text, enabling more accurate and relevant search results.</p><h3 id="2-Enhanced-Contextual-Understanding"><a href="#2-Enhanced-Contextual-Understanding" class="headerlink" title="2. Enhanced Contextual Understanding"></a>2. Enhanced Contextual Understanding</h3><p>Vector stores can store embeddings of text, which encapsulate the semantic context of the information. This helps in understanding and retrieving information that is contextually similar, even if it does not contain the exact keywords used in the query.</p><h3 id="3-Scaling-Large-Datasets"><a href="#3-Scaling-Large-Datasets" class="headerlink" title="3. Scaling Large Datasets"></a>3. Scaling Large Datasets</h3><p>As the amount of data grows, traditional search methods become less efficient. Vector stores enable scalable and fast retrieval from large datasets, making it feasible to handle and search through extensive corpora.</p><h3 id="4-Personalization-and-Recommendations"><a href="#4-Personalization-and-Recommendations" class="headerlink" title="4. Personalization and Recommendations"></a>4. Personalization and Recommendations</h3><p>Vector embeddings can be used to understand user preferences and behaviors. By storing user interactions as vectors, the model can provide personalized responses and recommendations based on the user’s past queries and interactions.</p><h3 id="5-Semantic-Search-Capabilities"><a href="#5-Semantic-Search-Capabilities" class="headerlink" title="5. Semantic Search Capabilities"></a>5. Semantic Search Capabilities</h3><p>Vector stores enable semantic search, where the search engine understands the meaning behind the query and retrieves information that matches the intent rather than just the keywords. This results in more accurate and relevant responses.</p><h3 id="6-Knowledge-Integration"><a href="#6-Knowledge-Integration" class="headerlink" title="6. Knowledge Integration"></a>6. Knowledge Integration</h3><p>Incorporating a vector store allows for the integration of external knowledge bases with the model. This means that the model can access a broader range of information beyond its training data, improving the accuracy and breadth of responses.</p><h3 id="7-Real-time-Updates"><a href="#7-Real-time-Updates" class="headerlink" title="7. Real-time Updates"></a>7. Real-time Updates</h3><p>Vector stores can be updated in real-time with new information, ensuring that the model has access to the most current data and can respond accurately to time-sensitive queries.</p><h3 id="Implementation-Aspects"><a href="#Implementation-Aspects" class="headerlink" title="Implementation Aspects:"></a>Implementation Aspects:</h3><ul><li><strong>Vector Embeddings</strong>: Text is converted into high-dimensional vectors using embedding techniques like BERT, GPT, or other neural network-based models.</li><li><strong>Storage and Indexing</strong>: These vectors are stored in a database optimized for vector search (e.g., Faiss, Annoy).</li><li><strong>Similarity Search</strong>: When a query is made, its vector representation is compared with stored vectors to find the most similar ones using methods like cosine similarity</li></ul><hr><blockquote><p><strong>🍀后记🍀</strong><br>博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。<br><strong>🌸唠嗑QQ群</strong>:<a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">兔叽の魔术工房</a> (942848525)<br><strong>⭐B站账号</strong>:<a href="https://space.bilibili.com/98639326">白拾Official</a>(活跃于知识区和动画区)<br><strong>✨GitHub主页</strong>:<a href="https://github.com/YangSierCode000">YangSierCode000</a>(工程文件)<br><strong>⛳Discord社区</strong>:<a href="https://discord.g/nn5NDXMgae">AierLab</a>(人工智能社区)</p></blockquote>]]></content>
<summary type="html"><h2 id="what-is-the-purpose-to-have-vector-store-for-similarity-check-and-indexing-the-relevant-context-material"><a href="#what-is-the-purp</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="TechNote" scheme="https://discover304.top/categories/NoteBook/TechNote/"/>
<category term="Vector Store" scheme="https://discover304.top/tags/Vector-Store/"/>
<category term="Similarity Search" scheme="https://discover304.top/tags/Similarity-Search/"/>
<category term="Indexing" scheme="https://discover304.top/tags/Indexing/"/>
<category term="Machine Learning" scheme="https://discover304.top/tags/Machine-Learning/"/>
<category term="AI" scheme="https://discover304.top/tags/AI/"/>
</entry>
<entry>
<title>ChuanhuChatbot: Multimodal Input Handling and Evaluation</title>
<link href="https://discover304.top/2024/06/29/2024q2/185-1-mn-chuanhu/"/>
<id>https://discover304.top/2024/06/29/2024q2/185-1-mn-chuanhu/</id>
<published>2024-06-29T11:51:26.000Z</published>
<updated>2024-08-20T17:54:50.388Z</updated>
<content type="html"><![CDATA[<h2 id="1-ChuanhuChatbot-py"><a href="#1-ChuanhuChatbot-py" class="headerlink" title="1. ChuanhuChatbot.py"></a>1. ChuanhuChatbot.py</h2><p>user_input</p><p>chatgpt_predict_args<br>auto_name_chat_history_args</p><h2 id="2-base-model-py"><a href="#2-base-model-py" class="headerlink" title="2. base_model.py"></a>2. base_model.py</h2><p>prepare_inputs<br>real_inputs<br>fake_inputs/fake_input<br>注:inputs是针对带有多模态输入的信息,input是只有文本</p><p><img src="https://image.discover304.top/1719669586535.png" alt="1719669586535.png"></p><p>history<br>stream_next_chatbot</p><p><img src="https://image.discover304.top/1719669830253.png" alt="1719669830253.png"></p><p><img src="https://image.discover304.top/1719668922689.png" alt="1719668922689.png"></p><p><img src="https://image.discover304.top/1719669278998.png" alt="1719669278998.png"></p><p>get_answer_stream_iter (different model has different implementation of this function)</p><p><img src="https://image.discover304.top/1719669925926.png" alt="1719669925926.png"></p><p>PROMPT_TEMPLATE (in file: presets.py)</p><p><img src="https://image.discover304.top/1719670018110.png" alt="1719670018110.png"></p><h2 id="3-TODO-for-MultiverseNote-implementation"><a href="#3-TODO-for-MultiverseNote-implementation" class="headerlink" title="3. TODO for MultiverseNote implementation"></a>3. TODO for MultiverseNote implementation</h2><p><img src="https://image.discover304.top/1719670998080.png" alt="1719670998080.png"></p><p><img src="https://image.discover304.top/1719672602383.png" alt="1719672602383.png"></p><hr><blockquote><p><strong>🍀后记🍀</strong><br>博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。<br><strong>🌸唠嗑QQ群</strong>:<a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">兔叽の魔术工房</a> (942848525)<br><strong>⭐B站账号</strong>:<a href="https://space.bilibili.com/98639326">白拾Official</a>(活跃于知识区和动画区)<br><strong>✨GitHub主页</strong>:<a href="https://github.com/YangSierCode000">YangSierCode000</a>(工程文件)<br><strong>⛳Discord社区</strong>:<a href="https://discord.g/nn5NDXMgae">AierLab</a>(人工智能社区)</p></blockquote>]]></content>
<summary type="html"><h2 id="1-ChuanhuChatbot-py"><a href="#1-ChuanhuChatbot-py" class="headerlink" title="1. ChuanhuChatbot.py"></a>1. ChuanhuChatbot.py</h2><p></summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="TechNote" scheme="https://discover304.top/categories/NoteBook/TechNote/"/>
<category term="Python" scheme="https://discover304.top/tags/Python/"/>
<category term="ChuanhuChatbot" scheme="https://discover304.top/tags/ChuanhuChatbot/"/>
<category term="Multimodal Input" scheme="https://discover304.top/tags/Multimodal-Input/"/>
<category term="AI Development" scheme="https://discover304.top/tags/AI-Development/"/>
</entry>
<entry>
<title>Leveraging Embedding Indices in ChuanhuChatGPT: A Comprehensive Guide</title>
<link href="https://discover304.top/2024/06/29/2024q2/185-0-mn-chuanhu-explain/"/>
<id>https://discover304.top/2024/06/29/2024q2/185-0-mn-chuanhu-explain/</id>
<published>2024-06-29T03:03:52.000Z</published>
<updated>2024-08-20T17:54:52.431Z</updated>
<content type="html"><![CDATA[<p>ChuanhuChatGPT is an advanced GUI for interacting with the ChatGPT API and various large language models (LLMs). Among its numerous features, it includes robust functionalities for saving and managing chat history and embedding indices. This guide will provide an overview of how to set up and utilize these features effectively.</p><h3 id="1-Setting-Up-the-Setup-Wizard"><a href="#1-Setting-Up-the-Setup-Wizard" class="headerlink" title="1. Setting Up the Setup Wizard"></a>1. Setting Up the Setup Wizard</h3><p>The <code>setup_wizard</code> function initializes the setup process if the <code>config.json</code> file is not found. This function configures several key settings, including local embeddings and methods for naming conversation histories.</p><h4 id="1-1-Path-to-setup-wizard"><a href="#1-1-Path-to-setup-wizard" class="headerlink" title="1.1. Path to setup_wizard:"></a>1.1. Path to <code>setup_wizard</code>:</h4><ul><li><strong>File</strong>: <code>modules/utils.py</code></li><li><strong>Location</strong>: Defined starting at line 1059</li></ul><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> os</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">setup_wizard</span>():</span><br><span class="line"> <span class="keyword">if</span> <span class="keyword">not</span> os.path.exists(<span class="string">"config.json"</span>):</span><br><span class="line"> wizard = SetupWizard()</span><br><span class="line"> flag = <span class="literal">False</span></span><br><span class="line"> wizard[<span class="string">"multi_api_key"</span>] = <span class="literal">True</span></span><br><span class="line"></span><br><span class="line"> <span class="comment"># Setting local_embedding</span></span><br><span class="line"> wizard.<span class="built_in">set</span>(</span><br><span class="line"> [</span><br><span class="line"> ConfigItem(<span class="string">"local_embedding"</span>, <span class="string">"本地编制索引"</span>, <span class="built_in">type</span>=ConfigType.Bool),</span><br><span class="line"> <span class="string">"是否在本地编制知识库索引?如果是,可以在使用本地模型时离线使用知识库,否则使用OpenAI服务来编制索引(需要OpenAI API Key)。请确保你的电脑有至少16GB内存。"</span></span><br><span class="line"> ]</span><br><span class="line"> )</span><br><span class="line"></span><br><span class="line"> <span class="built_in">print</span>(</span><br><span class="line"> colorama.Back.GREEN + i18n(<span class="string">"现在开始设置其他在线模型的API Key"</span>) + colorama.Style.RESET_ALL</span><br><span class="line"> )</span><br><span class="line"></span><br><span class="line"> <span class="comment"># Auto naming chat history</span></span><br><span class="line"> wizard.<span class="built_in">set</span>(</span><br><span class="line"> [</span><br><span class="line"> ConfigItem(</span><br><span class="line"> <span class="string">"chat_name_method_index"</span>,</span><br><span class="line"> <span class="string">"自动命名对话历史的方式(0: 使用日期时间命名, 1: 使用第一条提问命名, 2: 使用模型自动总结。)"</span>,</span><br><span class="line"> <span class="built_in">type</span>=ConfigType.Number,</span><br><span class="line"> default=<span class="number">2</span>,</span><br><span class="line"> )</span><br><span class="line"> ],</span><br><span class="line"> <span class="string">"是否选择自动命名对话历史的方式?"</span></span><br><span class="line"> )</span><br></pre></td></tr></table></figure><h3 id="2-Managing-Chat-History-Exporting-to-JSON-and-Markdown"><a href="#2-Managing-Chat-History-Exporting-to-JSON-and-Markdown" class="headerlink" title="2. Managing Chat History: Exporting to JSON and Markdown"></a>2. Managing Chat History: Exporting to JSON and Markdown</h3><h4 id="2-1-Export-to-JSON"><a href="#2-1-Export-to-JSON" class="headerlink" title="2.1. Export to JSON"></a>2.1. Export to JSON</h4><p>To save chat history in JSON format, the functionality is implemented within <code>ChuanhuChatbot.py</code>, handling session states and user interactions.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> json</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">save_history_to_json</span>(<span class="params">chat_history, file_path=<span class="string">'chat_history.json'</span></span>):</span><br><span class="line"> <span class="keyword">with</span> <span class="built_in">open</span>(file_path, <span class="string">'w'</span>, encoding=<span class="string">'utf-8'</span>) <span class="keyword">as</span> f:</span><br><span class="line"> json.dump(chat_history, f, ensure_ascii=<span class="literal">False</span>, indent=<span class="number">4</span>)</span><br></pre></td></tr></table></figure><h4 id="2-2-Export-to-Markdown"><a href="#2-2-Export-to-Markdown" class="headerlink" title="2.2. Export to Markdown"></a>2.2. Export to Markdown</h4><p>To export chat history to Markdown, you can format the conversation entries appropriately and save them as a Markdown file.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">save_history_to_markdown</span>(<span class="params">chat_history, file_path=<span class="string">'chat_history.md'</span></span>):</span><br><span class="line"> <span class="keyword">with</span> <span class="built_in">open</span>(file_path, <span class="string">'w'</span>, encoding=<span class="string">'utf-8'</span>) <span class="keyword">as</span> f:</span><br><span class="line"> <span class="keyword">for</span> entry <span class="keyword">in</span> chat_history:</span><br><span class="line"> f.write(<span class="string">f"### <span class="subst">{entry[<span class="string">'role'</span>]}</span>\n\n<span class="subst">{entry[<span class="string">'content'</span>]}</span>\n\n"</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Sample usage</span></span><br><span class="line">chat_history = [</span><br><span class="line"> {<span class="string">'role'</span>: <span class="string">'user'</span>, <span class="string">'content'</span>: <span class="string">'What is the capital of France?'</span>},</span><br><span class="line"> {<span class="string">'role'</span>: <span class="string">'assistant'</span>, <span class="string">'content'</span>: <span class="string">'The capital of France is Paris.'</span>}</span><br><span class="line">]</span><br><span class="line"></span><br><span class="line">save_history_to_markdown(chat_history)</span><br></pre></td></tr></table></figure><h3 id="3-Handling-Embedding-Indices-with-FAISS"><a href="#3-Handling-Embedding-Indices-with-FAISS" class="headerlink" title="3. Handling Embedding Indices with FAISS"></a>3. Handling Embedding Indices with FAISS</h3><p>FAISS is used in ChuanhuChatGPT for efficient storage and retrieval of text embeddings, enabling powerful search and query capabilities.</p><h4 id="3-1-Creating-and-Saving-Embeddings"><a href="#3-1-Creating-and-Saving-Embeddings" class="headerlink" title="3.1. Creating and Saving Embeddings"></a>3.1. Creating and Saving Embeddings</h4><ul><li><strong>File</strong>: <code>modules/index_func.py</code></li><li><strong>Function</strong>: Embedding creation and saving</li></ul><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> langchain.vectorstores <span class="keyword">import</span> FAISS</span><br><span class="line"><span class="keyword">from</span> langchain.embeddings.openai <span class="keyword">import</span> OpenAIEmbeddings</span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">create_and_save_index</span>(<span class="params">documents, index_path=<span class="string">'faiss.index'</span></span>):</span><br><span class="line"> embeddings = OpenAIEmbeddings()</span><br><span class="line"> index = FAISS.from_documents(documents, embeddings)</span><br><span class="line"> index.save(index_path)</span><br></pre></td></tr></table></figure><h4 id="3-2-Loading-the-Index"><a href="#3-2-Loading-the-Index" class="headerlink" title="3.2. Loading the Index"></a>3.2. Loading the Index</h4><p>Load the saved FAISS index for efficient querying of stored embeddings.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">load_index</span>(<span class="params">index_path=<span class="string">'faiss.index'</span></span>):</span><br><span class="line"> <span class="keyword">return</span> FAISS.load(index_path)</span><br></pre></td></tr></table></figure><h3 id="4-Conclusion"><a href="#4-Conclusion" class="headerlink" title="4. Conclusion"></a>4. Conclusion</h3><p>ChuanhuChatGPT offers extensive capabilities for managing chat history and embedding indices. By leveraging these features, you can ensure efficient storage, retrieval, and documentation of your interactions. For detailed implementation and updates, refer to the <a href="https://github.com/GaiZhenbiao/ChuanhuChatGPT">ChuanhuChatGPT repository</a> on GitHub【21†source】【22†source】【23†source】【24†source】【25†source】. </p><p>These features enhance the usability and flexibility of ChuanhuChatGPT, making it a robust tool for interacting with and managing large language models.</p><hr><blockquote><p><strong>🍀后记🍀</strong><br>博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。<br><strong>🌸唠嗑QQ群</strong>:<a href="https://jq.qq.com/?_wv=1027&k=EaGddTQg">兔叽の魔术工房</a> (942848525)<br><strong>⭐B站账号</strong>:<a href="https://space.bilibili.com/98639326">白拾Official</a>(活跃于知识区和动画区)<br><strong>✨GitHub主页</strong>:<a href="https://github.com/YangSierCode000">YangSierCode000</a>(工程文件)<br><strong>⛳Discord社区</strong>:<a href="https://discord.g/nn5NDXMgae">AierLab</a>(人工智能社区)</p></blockquote>]]></content>
<summary type="html"><p>ChuanhuChatGPT is an advanced GUI for interacting with the ChatGPT API and various large language models (LLMs). Among its numerous featu</summary>
<category term="NoteBook" scheme="https://discover304.top/categories/NoteBook/"/>
<category term="TechNote" scheme="https://discover304.top/categories/NoteBook/TechNote/"/>
<category term="Python" scheme="https://discover304.top/tags/Python/"/>
<category term="ChuanhuChatGPT" scheme="https://discover304.top/tags/ChuanhuChatGPT/"/>
<category term="Embedding" scheme="https://discover304.top/tags/Embedding/"/>
<category term="FAISS" scheme="https://discover304.top/tags/FAISS/"/>
<category term="AI Tools" scheme="https://discover304.top/tags/AI-Tools/"/>
</entry>
</feed>