noshot 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- noshot/data/ML TS XAI/ML/1. PCA - EDA/PCA-EDA.ipynb +207 -0
- noshot/data/ML TS XAI/ML/1. PCA - EDA/balance-scale.csv +626 -0
- noshot/data/ML TS XAI/ML/1. PCA - EDA/input.txt +625 -0
- noshot/data/ML TS XAI/ML/2. KNN Classifier/KNN.ipynb +287 -0
- noshot/data/ML TS XAI/ML/2. KNN Classifier/balance-scale.csv +626 -0
- noshot/data/ML TS XAI/ML/2. KNN Classifier/input.txt +625 -0
- noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/LDA.ipynb +83 -0
- noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/balance-scale.csv +626 -0
- noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/input.txt +625 -0
- noshot/data/ML TS XAI/ML/4. Linear Regression/Linear-Regression.ipynb +117 -0
- noshot/data/ML TS XAI/ML/4. Linear Regression/machine-data.csv +210 -0
- noshot/data/ML TS XAI/ML/5. Logistic Regression/Logistic-Regression.ipynb +137 -0
- noshot/data/ML TS XAI/ML/5. Logistic Regression/wine-dataset.csv +179 -0
- noshot/data/ML TS XAI/ML/6. Bayesian Classifier/Bayesian.ipynb +129 -0
- noshot/data/ML TS XAI/ML/6. Bayesian Classifier/wine-dataset.csv +179 -0
- noshot/data/ML TS XAI/TS/1. EDA - Handling Time Series Data/Handling TS Data.ipynb +784 -0
- noshot/data/ML TS XAI/TS/1. EDA - Handling Time Series Data/raw_sales.csv +29581 -0
- noshot/data/ML TS XAI/TS/2. Feature Engineering/Feature Engineering-.ipynb +1445 -0
- noshot/data/ML TS XAI/TS/3. Temporal Relationships/Exploring Temporal Relationships.ipynb +603 -0
- noshot/data/ML TS XAI/TS/4. Up-Down-Sampling and Interploation/Up-Down-Sampling.ipynb +721 -0
- noshot/data/ML TS XAI/TS/4. Up-Down-Sampling and Interploation/shampoo_sales.csv +37 -0
- noshot/data/ML TS XAI/TS/5. Stationarity - Trend - Seasonality/Stationarity-Trend-Seasonality.ipynb +392 -0
- noshot/data/ML TS XAI/TS/5. Stationarity - Trend - Seasonality/daily-min-temperatures.csv +3651 -0
- noshot/data/ML TS XAI/TS/5. Stationarity - Trend - Seasonality/daily-total-female-births.csv +366 -0
- noshot/data/ML TS XAI/TS/6. Autocorrelation - Partial Autocorrelation/ACF-PACF.ipynb +175 -0
- noshot/data/ML TS XAI/TS/6. Autocorrelation - Partial Autocorrelation/daily-min-temperatures.csv +3651 -0
- {noshot-0.1.7.dist-info → noshot-0.1.9.dist-info}/METADATA +2 -2
- noshot-0.1.9.dist-info/RECORD +35 -0
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(A) Breadth First Search.ipynb +0 -112
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(B) Depth First Search.ipynb +0 -111
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(C) Uniform Cost Search.ipynb +0 -134
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(D) Depth Limites Search.ipynb +0 -115
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(E) Iterative Deepening DFS.ipynb +0 -123
- noshot/data/ML TS XAI/AIDS/10. ANOVA/2_ANOVA.csv +0 -769
- noshot/data/ML TS XAI/AIDS/10. ANOVA/One Way ANOVA (Repeated Measure).ipynb +0 -126
- noshot/data/ML TS XAI/AIDS/10. ANOVA/One Way ANOVA.ipynb +0 -134
- noshot/data/ML TS XAI/AIDS/10. ANOVA/Sample 1 Way ANOVA Test.ipynb +0 -119
- noshot/data/ML TS XAI/AIDS/10. ANOVA/Two Way ANOVA.ipynb +0 -138
- noshot/data/ML TS XAI/AIDS/10. ANOVA/reaction_time.csv +0 -5
- noshot/data/ML TS XAI/AIDS/10. ANOVA/sample_data.csv +0 -16
- noshot/data/ML TS XAI/AIDS/10. ANOVA/sleep_deprivation.csv +0 -4
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/3_Linear.csv +0 -4802
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression LAB.ipynb +0 -113
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression New- sklearn.ipynb +0 -118
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression.ipynb +0 -148
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/house_rate.csv +0 -22
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/Logistic Regression New- sklearn.ipynb +0 -128
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/Logistic Regression.ipynb +0 -145
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/default.csv +0 -1001
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/hours_scores_records.csv +0 -101
- noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(A) Astar.ipynb +0 -256
- noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(B) IDAstar.ipynb +0 -157
- noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(C) SMAstar.ipynb +0 -178
- noshot/data/ML TS XAI/AIDS/3. Genetic Algorithm/Genetic.ipynb +0 -95
- noshot/data/ML TS XAI/AIDS/4. Simulated Annealing/Simulated Annealing.ipynb +0 -74
- noshot/data/ML TS XAI/AIDS/4. Simulated Annealing/Sudoku Simulated Annealing.ipynb +0 -103
- noshot/data/ML TS XAI/AIDS/5. Alpha Beta Pruning/AlphaBetaPruning.ipynb +0 -182
- noshot/data/ML TS XAI/AIDS/6. Consraint Satisfaction Problems (CSP)/(A) CSP House Allocation.ipynb +0 -120
- noshot/data/ML TS XAI/AIDS/6. Consraint Satisfaction Problems (CSP)/(B) CSP Map Coloring.ipynb +0 -125
- noshot/data/ML TS XAI/AIDS/7. Random Sampling/Random Sampling.ipynb +0 -73
- noshot/data/ML TS XAI/AIDS/7. Random Sampling/height_weight_bmi.csv +0 -8389
- noshot/data/ML TS XAI/AIDS/8. Z Test/Z Test Hash Function.ipynb +0 -141
- noshot/data/ML TS XAI/AIDS/8. Z Test/Z Test.ipynb +0 -151
- noshot/data/ML TS XAI/AIDS/8. Z Test/height_weight_bmi.csv +0 -8389
- noshot/data/ML TS XAI/AIDS/9. T Test/1_heart.csv +0 -304
- noshot/data/ML TS XAI/AIDS/9. T Test/Independent T Test.ipynb +0 -119
- noshot/data/ML TS XAI/AIDS/9. T Test/Paired T Test.ipynb +0 -118
- noshot/data/ML TS XAI/AIDS/9. T Test/T Test Hash Function.ipynb +0 -142
- noshot/data/ML TS XAI/AIDS/9. T Test/T Test.ipynb +0 -158
- noshot/data/ML TS XAI/AIDS/9. T Test/height_weight_bmi.csv +0 -8389
- noshot/data/ML TS XAI/AIDS/9. T Test/iq_test.csv +0 -0
- noshot/data/ML TS XAI/AIDS/Others (AllinOne)/All In One.ipynb +0 -4581
- noshot/data/ML TS XAI/CN/1. Chat Application/chat.java +0 -81
- noshot/data/ML TS XAI/CN/1. Chat Application/output.png +0 -0
- noshot/data/ML TS XAI/CN/1. Chat Application/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/LAN.tcl +0 -65
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/analysis.awk +0 -44
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/output.png +0 -0
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/complexdcf.tcl +0 -229
- noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/output.png +0 -0
- noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/2. File Transfer/file_to_send.txt +0 -2
- noshot/data/ML TS XAI/CN/2. File Transfer/filetransfer.java +0 -119
- noshot/data/ML TS XAI/CN/2. File Transfer/output.png +0 -0
- noshot/data/ML TS XAI/CN/2. File Transfer/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/Client.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/MyServerImpl.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/MyServerIntf.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/Server.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/output.png +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/rmi.java +0 -56
- noshot/data/ML TS XAI/CN/4. Wired Network/output.png +0 -0
- noshot/data/ML TS XAI/CN/4. Wired Network/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/4. Wired Network/wired.awk +0 -25
- noshot/data/ML TS XAI/CN/4. Wired Network/wired.tcl +0 -81
- noshot/data/ML TS XAI/CN/5. Wireless Network/output.png +0 -0
- noshot/data/ML TS XAI/CN/5. Wireless Network/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/5. Wireless Network/wireless.awk +0 -27
- noshot/data/ML TS XAI/CN/5. Wireless Network/wireless.tcl +0 -153
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/analysis.awk +0 -27
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/output.png +0 -0
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/sack.tcl +0 -86
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/vegas.tcl +0 -86
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/analysis.awk +0 -28
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/output.png +0 -0
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/reno.tcl +0 -78
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/tahoe.tcl +0 -79
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/analysis.awk +0 -27
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/flow.tcl +0 -163
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/output.png +0 -0
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/DV.tcl +0 -111
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/LS.tcl +0 -106
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/analysis.awk +0 -36
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/output.png +0 -0
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/analysis.awk +0 -20
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/broadcast.tcl +0 -76
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/multicast.tcl +0 -103
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/output.png +0 -0
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/9. DHCP/DHCP.java +0 -125
- noshot/data/ML TS XAI/CN/9. DHCP/output.png +0 -0
- noshot/data/ML TS XAI/CN/9. DHCP/procedure.png +0 -0
- noshot/data/ML TS XAI/NLP/NLP 1/1-Prereqs.py +0 -18
- noshot/data/ML TS XAI/NLP/NLP 1/2-Chi2test.py +0 -83
- noshot/data/ML TS XAI/NLP/NLP 1/2-T-test.py +0 -79
- noshot/data/ML TS XAI/NLP/NLP 1/3-WSD-nb.py +0 -53
- noshot/data/ML TS XAI/NLP/NLP 1/4-Hindle-Rooth.py +0 -53
- noshot/data/ML TS XAI/NLP/NLP 1/5-HMM-Trellis.py +0 -82
- noshot/data/ML TS XAI/NLP/NLP 1/6-HMM-Viterbi.py +0 -16
- noshot/data/ML TS XAI/NLP/NLP 1/7-PCFG-parsetree.py +0 -15
- noshot/data/ML TS XAI/NLP/NLP 1/Chi2test.ipynb +0 -285
- noshot/data/ML TS XAI/NLP/NLP 1/Hindle-Rooth.ipynb +0 -179
- noshot/data/ML TS XAI/NLP/NLP 1/Lab 10 - Text generator using LSTM.ipynb +0 -1461
- noshot/data/ML TS XAI/NLP/NLP 1/Lab 11 NMT.ipynb +0 -2307
- noshot/data/ML TS XAI/NLP/NLP 1/PCFG.ipynb +0 -134
- noshot/data/ML TS XAI/NLP/NLP 1/Prereqs.ipynb +0 -131
- noshot/data/ML TS XAI/NLP/NLP 1/T test.ipynb +0 -252
- noshot/data/ML TS XAI/NLP/NLP 1/TFIDF BOW.ipynb +0 -171
- noshot/data/ML TS XAI/NLP/NLP 1/Trellis.ipynb +0 -244
- noshot/data/ML TS XAI/NLP/NLP 1/WSD.ipynb +0 -645
- noshot/data/ML TS XAI/NLP/NLP 1/Word2Vec.ipynb +0 -93
- noshot/data/ML TS XAI/NLP/NLP 2/Lab01(tokenizer)/tokenizer.ipynb +0 -370
- noshot/data/ML TS XAI/NLP/NLP 2/Lab01(tokenizer)/training_tokenizer.txt +0 -6
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/exp0.ipynb +0 -274
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/lab2.ipynb +0 -905
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/test.txt +0 -1
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/tokenizing.ipynb +0 -272
- noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/collocation.ipynb +0 -332
- noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/lab3.ipynb +0 -549
- noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/nlp.txt +0 -1
- noshot/data/ML TS XAI/NLP/NLP 2/Lab04(collocation)/Lab4-NLP-Exp-2.ipynb +0 -817
- noshot/data/ML TS XAI/NLP/NLP 2/Lab04(collocation)/collocation.ipynb +0 -332
- noshot/data/ML TS XAI/NLP/NLP 2/Lab05(WSD)/NLP-Lab-5-Exp3.ipynb +0 -231
- noshot/data/ML TS XAI/NLP/NLP 2/Lab05(WSD)/word-sense-disambiguation.ipynb +0 -507
- noshot/data/ML TS XAI/NLP/NLP 2/Lab06(additional-exercise)/lab6.ipynb +0 -134
- noshot/data/ML TS XAI/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP Exp 4.ipynb +0 -255
- noshot/data/ML TS XAI/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP_Exp_5.ipynb +0 -159
- noshot/data/ML TS XAI/NLP/NLP 2/Lab08(PCFG)/PCFG.ipynb +0 -282
- noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/Lab 9 - MLP classifier.ipynb +0 -670
- noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/MLP-alternative-code.ipynb +0 -613
- noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/hindle-rooth-algorithm.ipynb +0 -74
- noshot/data/ML TS XAI/NLP/NLP 2/Lab10(LSTM)/Lab_10_Text_generator_using_LSTM.ipynb +0 -480
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Machine-translation.ipynb +0 -445
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Viterbi-PCFG.ipynb +0 -105
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/corpora_tools.py +0 -87
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/data_utils.py +0 -11
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/train_translator.py +0 -83
- noshot/data/ML TS XAI/NLP/NLP 2/Lab12(Information-Extraction)/Information_Extraction.ipynb +0 -201
- noshot/data/ML TS XAI/NLP/NLP 3/Backtrack-without-Verbitri.ipynb +0 -185
- noshot/data/ML TS XAI/NLP/NLP 3/Backward-Procedure.ipynb +0 -597
- noshot/data/ML TS XAI/NLP/NLP 3/Bag_of.ipynb +0 -1422
- noshot/data/ML TS XAI/NLP/NLP 3/CYK-algorithm.ipynb +0 -1067
- noshot/data/ML TS XAI/NLP/NLP 3/Forward-Procedure.ipynb +0 -477
- noshot/data/ML TS XAI/NLP/NLP 3/LSTM.ipynb +0 -1290
- noshot/data/ML TS XAI/NLP/NLP 3/Lab 10 - Text generator using LSTM.ipynb +0 -1461
- noshot/data/ML TS XAI/NLP/NLP 3/Lab 11 NMT.ipynb +0 -2307
- noshot/data/ML TS XAI/NLP/NLP 3/NLP-LAB-4.ipynb +0 -216
- noshot/data/ML TS XAI/NLP/NLP 3/NLP-LAB-5.ipynb +0 -216
- noshot/data/ML TS XAI/NLP/NLP 3/abc.txt +0 -6
- noshot/data/ML TS XAI/NLP/NLP 3/ex-1-nltk.ipynb +0 -711
- noshot/data/ML TS XAI/NLP/NLP 3/ex-2-nlp.ipynb +0 -267
- noshot/data/ML TS XAI/NLP/NLP 3/exp8&9.ipynb +0 -305
- noshot/data/ML TS XAI/NLP/NLP 3/hind.ipynb +0 -287
- noshot/data/ML TS XAI/NLP/NLP 3/lab66.ipynb +0 -752
- noshot/data/ML TS XAI/NLP/NLP 3/leb_3.ipynb +0 -612
- noshot/data/ML TS XAI/NLP/NLP 3/naive_bayes_classifier.pkl +0 -0
- noshot/data/ML TS XAI/NLP/NLP 3/nlp_leb_1.ipynb +0 -3008
- noshot/data/ML TS XAI/NLP/NLP 3/nlp_leb_2.ipynb +0 -3095
- noshot/data/ML TS XAI/NLP/NLP 3/nlplab-9.ipynb +0 -295
- noshot/data/ML TS XAI/NLP/NLP 3/nltk-ex-4.ipynb +0 -506
- noshot/data/ML TS XAI/NLP/NLP 3/text1.txt +0 -48
- noshot/data/ML TS XAI/NLP/NLP 3/text2.txt +0 -8
- noshot/data/ML TS XAI/NLP/NLP 3/text3.txt +0 -48
- noshot/data/ML TS XAI/NLP/NLP 3/translation-rnn.ipynb +0 -812
- noshot/data/ML TS XAI/NLP/NLP 3/word2vector.ipynb +0 -173
- noshot/data/ML TS XAI/NLP/NLP 4/Backward Procedure Algorithm.ipynb +0 -179
- noshot/data/ML TS XAI/NLP/NLP 4/Chi Square Collocation.ipynb +0 -208
- noshot/data/ML TS XAI/NLP/NLP 4/Collocation (T test).ipynb +0 -188
- noshot/data/ML TS XAI/NLP/NLP 4/Experiment 1.ipynb +0 -437
- noshot/data/ML TS XAI/NLP/NLP 4/Forward Procedure Algorithm.ipynb +0 -132
- noshot/data/ML TS XAI/NLP/NLP 4/Hindle Rooth.ipynb +0 -414
- noshot/data/ML TS XAI/NLP/NLP 4/MachineTranslation.ipynb +0 -368
- noshot/data/ML TS XAI/NLP/NLP 4/Multi Layer Perceptron using MLPClassifier.ipynb +0 -86
- noshot/data/ML TS XAI/NLP/NLP 4/Multi Layer Perceptron using Tensorflow.ipynb +0 -112
- noshot/data/ML TS XAI/NLP/NLP 4/PCFG Inside Probability.ipynb +0 -451
- noshot/data/ML TS XAI/NLP/NLP 4/Text Generation using LSTM.ipynb +0 -297
- noshot/data/ML TS XAI/NLP/NLP 4/Viterbi.ipynb +0 -310
- noshot/data/ML TS XAI/NLP/NLP 4/Word Sense Disambiguation.ipynb +0 -335
- noshot/data/ML TS XAI/NLP/NLP 5/10.Text Generation using LSTM.ipynb +0 -316
- noshot/data/ML TS XAI/NLP/NLP 5/11.Machine Translation.ipynb +0 -868
- noshot/data/ML TS XAI/NLP/NLP 5/2.T and Chi2 Test.ipynb +0 -204
- noshot/data/ML TS XAI/NLP/NLP 5/3.Word Sense Diambiguation.ipynb +0 -234
- noshot/data/ML TS XAI/NLP/NLP 5/4.Hinddle and Rooth.ipynb +0 -128
- noshot/data/ML TS XAI/NLP/NLP 5/5.Forward and Backward.ipynb +0 -149
- noshot/data/ML TS XAI/NLP/NLP 5/6.Viterbi.ipynb +0 -111
- noshot/data/ML TS XAI/NLP/NLP 5/7.PCFG Parse Tree.ipynb +0 -134
- noshot/data/ML TS XAI/NLP/NLP 5/7.PCFG using cyk.ipynb +0 -101
- noshot/data/ML TS XAI/NLP/NLP 5/8.Bag of words and TF-IDF.ipynb +0 -310
- noshot/data/ML TS XAI/NLP/NLP 5/9.Word2Vector.ipynb +0 -78
- noshot/data/ML TS XAI/NLP/NLP 5/NLP ALL In One.ipynb +0 -2619
- noshot/data/ML TS XAI/NLP/NLP 5/sample1.txt +0 -15
- noshot/data/ML TS XAI/NLP/NLP 5/sample2.txt +0 -4
- noshot/data/ML TS XAI/NLP/NLP 5/word2vec_model.bin +0 -0
- noshot/data/ML TS XAI/NLP/NLP 6/1. Tokenize, Tagging, NER, Parse Tree.ipynb +0 -312
- noshot/data/ML TS XAI/NLP/NLP 6/2. T Test and Chi2 Test.ipynb +0 -185
- noshot/data/ML TS XAI/NLP/NLP 6/3. Naive Bayes WSD.ipynb +0 -199
- noshot/data/ML TS XAI/NLP/NLP 6/4. Hinddle and Rooth.ipynb +0 -151
- noshot/data/ML TS XAI/NLP/NLP 6/5 and 6 FWD, BWD, Viterbi.ipynb +0 -164
- noshot/data/ML TS XAI/NLP/NLP 6/7. PCFG using CYK.ipynb +0 -383
- noshot/data/ML TS XAI/NLP/NLP 6/8. BOW and TF-IDF.ipynb +0 -252
- noshot/data/ML TS XAI/Ubuntu CN Lab.iso +0 -0
- noshot-0.1.7.dist-info/RECORD +0 -216
- {noshot-0.1.7.dist-info → noshot-0.1.9.dist-info}/LICENSE.txt +0 -0
- {noshot-0.1.7.dist-info → noshot-0.1.9.dist-info}/WHEEL +0 -0
- {noshot-0.1.7.dist-info → noshot-0.1.9.dist-info}/top_level.txt +0 -0
@@ -1,199 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "markdown",
|
5
|
-
"id": "26e01d66-ef30-485e-9881-6d81cfba8004",
|
6
|
-
"metadata": {},
|
7
|
-
"source": [
|
8
|
-
"# Experiment 3 :\n",
|
9
|
-
"<b>Implement decision rule-based Naïve Bayes disambiguation method to find the sense of an\r\n",
|
10
|
-
"ambiguous word with the given training set.</b>"
|
11
|
-
]
|
12
|
-
},
|
13
|
-
{
|
14
|
-
"cell_type": "code",
|
15
|
-
"execution_count": 58,
|
16
|
-
"id": "81e97c34-fe56-467e-b7f0-a49732847a35",
|
17
|
-
"metadata": {},
|
18
|
-
"outputs": [],
|
19
|
-
"source": [
|
20
|
-
"import nltk\n",
|
21
|
-
"from nltk import word_tokenize\n",
|
22
|
-
"from nltk.corpus import stopwords\n",
|
23
|
-
"import string\n",
|
24
|
-
"import math\n",
|
25
|
-
"\n",
|
26
|
-
"#PRE-PROCESS THE SENTENCE by tokenizing and removing stopwords\n",
|
27
|
-
"def process(sentence) :\n",
|
28
|
-
" sentence = sentence.translate(str.maketrans('', '', string.punctuation))\n",
|
29
|
-
" word_tokens = word_tokenize(sentence)\n",
|
30
|
-
" stops = set(stopwords.words('english'))\n",
|
31
|
-
" return [word for word in word_tokens if word.lower() not in stops]\n",
|
32
|
-
"\n",
|
33
|
-
"with open('lab3.txt', 'r') as f :\n",
|
34
|
-
" text = f.read()\n",
|
35
|
-
"dataset = {}\n",
|
36
|
-
"for data in text.split('\\n') :\n",
|
37
|
-
" sentence, sense = data.split(':')\n",
|
38
|
-
" if sense in dataset :\n",
|
39
|
-
" dataset[sense].append(sentence)\n",
|
40
|
-
" else :\n",
|
41
|
-
" dataset[sense] = [sentence]\n",
|
42
|
-
"\n"
|
43
|
-
]
|
44
|
-
},
|
45
|
-
{
|
46
|
-
"cell_type": "code",
|
47
|
-
"execution_count": 59,
|
48
|
-
"id": "f76f3399-bb88-4dac-896d-b971756b9954",
|
49
|
-
"metadata": {},
|
50
|
-
"outputs": [],
|
51
|
-
"source": [
|
52
|
-
"formatted_dataset = {sense : [] for sense in dataset}\n",
|
53
|
-
"for sense, sentences in dataset.items() :\n",
|
54
|
-
" for sentence in sentences :\n",
|
55
|
-
" formatted_dataset[sense] += process(sentence)"
|
56
|
-
]
|
57
|
-
},
|
58
|
-
{
|
59
|
-
"cell_type": "code",
|
60
|
-
"execution_count": 60,
|
61
|
-
"id": "0286919d-2ef3-4b85-a3ff-9f4485976b77",
|
62
|
-
"metadata": {},
|
63
|
-
"outputs": [],
|
64
|
-
"source": [
|
65
|
-
"vocabulary = {}\n",
|
66
|
-
"for words in formatted_dataset.values() :\n",
|
67
|
-
" for word in words :\n",
|
68
|
-
" if word in vocabulary :\n",
|
69
|
-
" vocabulary[word] += 1\n",
|
70
|
-
" else :\n",
|
71
|
-
" vocabulary[word] = 1\n",
|
72
|
-
" \n",
|
73
|
-
"priors = {sense : len(dataset[sense])/len(dataset) for sense in dataset}\n",
|
74
|
-
"\n",
|
75
|
-
"conditionals = {}\n",
|
76
|
-
"for word in vocabulary :\n",
|
77
|
-
" conditionals[word] = dict()\n",
|
78
|
-
" for sense in dataset :\n",
|
79
|
-
" count_wc = formatted_dataset[sense].count(word)\n",
|
80
|
-
" count_c = len(dataset[sense])\n",
|
81
|
-
" prop = (count_wc + 1) / (count_c + len(vocabulary))\n",
|
82
|
-
" conditionals[word][sense] = prop\n",
|
83
|
-
" "
|
84
|
-
]
|
85
|
-
},
|
86
|
-
{
|
87
|
-
"cell_type": "code",
|
88
|
-
"execution_count": 61,
|
89
|
-
"id": "4f5d059c-4fde-4655-b8d5-680132870a06",
|
90
|
-
"metadata": {},
|
91
|
-
"outputs": [],
|
92
|
-
"source": [
|
93
|
-
"def naive_bayes(sentence, priors, conditionals) :\n",
|
94
|
-
" words = process(sentence)\n",
|
95
|
-
" scores = {}\n",
|
96
|
-
" for sense in priors :\n",
|
97
|
-
" value = math.log(priors[sense])\n",
|
98
|
-
" for word in words :\n",
|
99
|
-
" if word in conditionals :\n",
|
100
|
-
" value += math.log(conditionals[word][sense])\n",
|
101
|
-
" else :\n",
|
102
|
-
" value += math.log(1e-10)\n",
|
103
|
-
" scores[sense] = value\n",
|
104
|
-
"\n",
|
105
|
-
" sense_predicted = max(scores, key = scores.get)\n",
|
106
|
-
" print(f\"{sentence}\\nSENSE : {sense_predicted}\\nSCORE : {scores[sense_predicted]}\")\n",
|
107
|
-
" \n"
|
108
|
-
]
|
109
|
-
},
|
110
|
-
{
|
111
|
-
"cell_type": "code",
|
112
|
-
"execution_count": 62,
|
113
|
-
"id": "adb227ad-78bb-454d-b0a4-5764014f2ed9",
|
114
|
-
"metadata": {},
|
115
|
-
"outputs": [
|
116
|
-
{
|
117
|
-
"name": "stdout",
|
118
|
-
"output_type": "stream",
|
119
|
-
"text": [
|
120
|
-
"The light breeze was refreshing on a warm summer day.\n",
|
121
|
-
"SENSE : Light (not intense)\n",
|
122
|
-
"SCORE : -25.59000306801089\n",
|
123
|
-
"She preferred light exercise, like walking and yoga.\n",
|
124
|
-
"SENSE : Light (not intense)\n",
|
125
|
-
"SCORE : -26.113251211775438\n",
|
126
|
-
"This box is so light I can carry it with one hand.\n",
|
127
|
-
"SENSE : Light (not heavy)\n",
|
128
|
-
"SCORE : -20.61710810189748\n",
|
129
|
-
"The light from the lamp was too bright for my eyes.\n",
|
130
|
-
"SENSE : Light (brightness)\n",
|
131
|
-
"SCORE : -16.37372796051489\n",
|
132
|
-
"The light jacket was just perfect for the cool evening air.\n",
|
133
|
-
"SENSE : Light (not heavy)\n",
|
134
|
-
"SCORE : -26.40093328422722\n",
|
135
|
-
"The light color of the walls made the room look bigger.\n",
|
136
|
-
"SENSE : Light (color/appearance)\n",
|
137
|
-
"SCORE : -29.476708265454747\n",
|
138
|
-
"He gave a light chuckle when he heard the funny joke.\n",
|
139
|
-
"SENSE : Light (mood/atmosphere)\n",
|
140
|
-
"SCORE : -27.078332107819023\n",
|
141
|
-
"I ordered a light meal because I wasn’t very hungry.\n",
|
142
|
-
"SENSE : Light (not intense)\n",
|
143
|
-
"SCORE : -39.65089331873625\n",
|
144
|
-
"She wore a light dress for the summer party.\n",
|
145
|
-
"SENSE : Light (color/appearance)\n",
|
146
|
-
"SCORE : -20.61710810189748\n",
|
147
|
-
"The light from the fireworks illuminated the night sky.\n",
|
148
|
-
"SENSE : Light (brightness)\n",
|
149
|
-
"SCORE : -20.653475746068356\n"
|
150
|
-
]
|
151
|
-
}
|
152
|
-
],
|
153
|
-
"source": [
|
154
|
-
"test_data = ['The light breeze was refreshing on a warm summer day.',\n",
|
155
|
-
" 'She preferred light exercise, like walking and yoga.',\n",
|
156
|
-
" 'This box is so light I can carry it with one hand.',\n",
|
157
|
-
" 'The light from the lamp was too bright for my eyes.',\n",
|
158
|
-
" 'The light jacket was just perfect for the cool evening air.',\n",
|
159
|
-
" 'The light color of the walls made the room look bigger.',\n",
|
160
|
-
" 'He gave a light chuckle when he heard the funny joke.',\n",
|
161
|
-
" 'I ordered a light meal because I wasn’t very hungry.',\n",
|
162
|
-
" 'She wore a light dress for the summer party.',\n",
|
163
|
-
" 'The light from the fireworks illuminated the night sky.']\n",
|
164
|
-
"\n",
|
165
|
-
"for data in test_data :\n",
|
166
|
-
" naive_bayes(data, priors, conditionals)"
|
167
|
-
]
|
168
|
-
},
|
169
|
-
{
|
170
|
-
"cell_type": "code",
|
171
|
-
"execution_count": null,
|
172
|
-
"id": "c0e4a3b9-458b-47f0-9c39-c324116f24b3",
|
173
|
-
"metadata": {},
|
174
|
-
"outputs": [],
|
175
|
-
"source": []
|
176
|
-
}
|
177
|
-
],
|
178
|
-
"metadata": {
|
179
|
-
"kernelspec": {
|
180
|
-
"display_name": "Python 3 (ipykernel)",
|
181
|
-
"language": "python",
|
182
|
-
"name": "python3"
|
183
|
-
},
|
184
|
-
"language_info": {
|
185
|
-
"codemirror_mode": {
|
186
|
-
"name": "ipython",
|
187
|
-
"version": 3
|
188
|
-
},
|
189
|
-
"file_extension": ".py",
|
190
|
-
"mimetype": "text/x-python",
|
191
|
-
"name": "python",
|
192
|
-
"nbconvert_exporter": "python",
|
193
|
-
"pygments_lexer": "ipython3",
|
194
|
-
"version": "3.11.5"
|
195
|
-
}
|
196
|
-
},
|
197
|
-
"nbformat": 4,
|
198
|
-
"nbformat_minor": 5
|
199
|
-
}
|
@@ -1,151 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "markdown",
|
5
|
-
"id": "8b4fc6c3-60e4-4125-b0a0-64d3b83a7a85",
|
6
|
-
"metadata": {},
|
7
|
-
"source": [
|
8
|
-
"# Experiment 4 :\n",
|
9
|
-
"<b>Implement the Hindle and Rooth algorithm for solving the attachment ambiguity problem.</b>"
|
10
|
-
]
|
11
|
-
},
|
12
|
-
{
|
13
|
-
"cell_type": "code",
|
14
|
-
"execution_count": 68,
|
15
|
-
"id": "1a6a36a7-daba-4c9f-8067-8262c924558c",
|
16
|
-
"metadata": {},
|
17
|
-
"outputs": [],
|
18
|
-
"source": [
|
19
|
-
"import nltk\n",
|
20
|
-
"from nltk import word_tokenize, sent_tokenize, pos_tag\n",
|
21
|
-
"from nltk.corpus import stopwords\n",
|
22
|
-
"import string\n",
|
23
|
-
"import math\n",
|
24
|
-
"\n",
|
25
|
-
"with open('lab4.txt', 'r') as f :\n",
|
26
|
-
" text = f.read()\n",
|
27
|
-
"text = text.translate(str.maketrans('', '', string.punctuation))\n",
|
28
|
-
"text.replace('\\n', '')\n",
|
29
|
-
"tokens = word_tokenize(text)\n",
|
30
|
-
"tokens = [word for word in tokens if word.lower() not in ['a', 'an', 'the']]\n",
|
31
|
-
"bigrams = {}\n",
|
32
|
-
"for bigram in zip(tokens[:-1], tokens[1:]) :\n",
|
33
|
-
" bigrams[bigram] = bigrams.get(bigram,0) + 1\n",
|
34
|
-
"\n",
|
35
|
-
"frequency = {}\n",
|
36
|
-
"for word in tokens :\n",
|
37
|
-
" frequency[word] = frequency.get(word,0) + 1"
|
38
|
-
]
|
39
|
-
},
|
40
|
-
{
|
41
|
-
"cell_type": "code",
|
42
|
-
"execution_count": 61,
|
43
|
-
"id": "fc5414ff-9e7b-43b2-bc54-a7c564ffc3d4",
|
44
|
-
"metadata": {},
|
45
|
-
"outputs": [],
|
46
|
-
"source": [
|
47
|
-
"# use this to get a list of available text files\n",
|
48
|
-
"#print(gutenberg.fileids())"
|
49
|
-
]
|
50
|
-
},
|
51
|
-
{
|
52
|
-
"cell_type": "code",
|
53
|
-
"execution_count": 77,
|
54
|
-
"id": "2a46a595-3c13-4d70-96a3-578ed19be1bc",
|
55
|
-
"metadata": {},
|
56
|
-
"outputs": [],
|
57
|
-
"source": [
|
58
|
-
"def hindle_and_rooth(verb, prop, noun, frequency, bigrams) :\n",
|
59
|
-
" nc = frequency.get(noun, 0)\n",
|
60
|
-
" vc = frequency.get(verb, 0)\n",
|
61
|
-
" pvc = bigrams.get((verb, prop), 0)\n",
|
62
|
-
" pnc = bigrams.get((prop, noun), 0)\n",
|
63
|
-
" P_VA = pvc/vc if vc > 0 else 0\n",
|
64
|
-
" P_NA = pnc/nc if nc > 0 else 0\n",
|
65
|
-
" print(P_VA, P_NA)\n",
|
66
|
-
"\n",
|
67
|
-
" if not P_VA :\n",
|
68
|
-
" print(f\"No occuurance of {prop} with {verb}\")\n",
|
69
|
-
" print(f\"{prop} is attached with {noun} : Noun Attachment\")\n",
|
70
|
-
" return\n",
|
71
|
-
" if not P_NA :\n",
|
72
|
-
" print(f\"No occuurance of {prop} with {noun}\")\n",
|
73
|
-
" print(f\"{prop} is attached with {verb} : Verb Attachment\")\n",
|
74
|
-
" return\n",
|
75
|
-
"\n",
|
76
|
-
" try :\n",
|
77
|
-
" x = (P_VA * (1 - P_NA))/P_NA\n",
|
78
|
-
" lam = math.log2(x)\n",
|
79
|
-
" if lam > 0 :\n",
|
80
|
-
" print(f\"{prop} is attached with {verb} : Verb Attachment\")\n",
|
81
|
-
" else :\n",
|
82
|
-
" print(f\"{prop} is attached with {noun} : Noun Attachment\")\n",
|
83
|
-
" except :\n",
|
84
|
-
" print(f\"DATA INSUFFUCIENCY TO ARRIVE AT THE CONCLUSION\")\n",
|
85
|
-
" finally :\n",
|
86
|
-
" print(f\"occurance of noun in corpus : {nc}\")\n",
|
87
|
-
" print(f\"occurance of verb in corpus : {vc}\")\n",
|
88
|
-
" print(f\"occurance of verb and prop : {pvc}\")\n",
|
89
|
-
" print(f\"occurance of noun and prop : {pnc}\")\n",
|
90
|
-
" print(f\"Propability of noun attachment : {P_NA}\")\n",
|
91
|
-
" print(f\"Propability of verb attachment : {P_VA}\")\n",
|
92
|
-
" \n",
|
93
|
-
" "
|
94
|
-
]
|
95
|
-
},
|
96
|
-
{
|
97
|
-
"cell_type": "code",
|
98
|
-
"execution_count": 78,
|
99
|
-
"id": "af0598a4-dfad-4c05-b575-3a1e1d74c5b0",
|
100
|
-
"metadata": {},
|
101
|
-
"outputs": [
|
102
|
-
{
|
103
|
-
"name": "stdout",
|
104
|
-
"output_type": "stream",
|
105
|
-
"text": [
|
106
|
-
"0.3333333333333333 1.0\n",
|
107
|
-
"DATA INSUFFUCIENCY TO ARRIVE AT THE CONCLUSION\n",
|
108
|
-
"occurance of noun in corpus : 2\n",
|
109
|
-
"occurance of verb in corpus : 6\n",
|
110
|
-
"occurance of verb and prop : 2\n",
|
111
|
-
"occurance of noun and prop : 2\n",
|
112
|
-
"Propability of noun attachment : 1.0\n",
|
113
|
-
"Propability of verb attachment : 0.3333333333333333\n"
|
114
|
-
]
|
115
|
-
}
|
116
|
-
],
|
117
|
-
"source": [
|
118
|
-
"hindle_and_rooth('sat', 'on', 'bench', frequency, bigrams)"
|
119
|
-
]
|
120
|
-
},
|
121
|
-
{
|
122
|
-
"cell_type": "code",
|
123
|
-
"execution_count": null,
|
124
|
-
"id": "dd37851f-b4e9-4a99-9d2e-8b909db292a2",
|
125
|
-
"metadata": {},
|
126
|
-
"outputs": [],
|
127
|
-
"source": []
|
128
|
-
}
|
129
|
-
],
|
130
|
-
"metadata": {
|
131
|
-
"kernelspec": {
|
132
|
-
"display_name": "Python 3 (ipykernel)",
|
133
|
-
"language": "python",
|
134
|
-
"name": "python3"
|
135
|
-
},
|
136
|
-
"language_info": {
|
137
|
-
"codemirror_mode": {
|
138
|
-
"name": "ipython",
|
139
|
-
"version": 3
|
140
|
-
},
|
141
|
-
"file_extension": ".py",
|
142
|
-
"mimetype": "text/x-python",
|
143
|
-
"name": "python",
|
144
|
-
"nbconvert_exporter": "python",
|
145
|
-
"pygments_lexer": "ipython3",
|
146
|
-
"version": "3.11.5"
|
147
|
-
}
|
148
|
-
},
|
149
|
-
"nbformat": 4,
|
150
|
-
"nbformat_minor": 5
|
151
|
-
}
|
@@ -1,164 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "markdown",
|
5
|
-
"id": "8bc54aa3-b46b-4077-983b-6420776ec43f",
|
6
|
-
"metadata": {},
|
7
|
-
"source": [
|
8
|
-
"# Experiment 5 & 6 :\n",
|
9
|
-
"\n",
|
10
|
-
"<b>Implement forward and backward procedures using Hidden Markov Model to find the\n",
|
11
|
-
"probability of a word sequence given a hidden Markov model.</b>\n",
|
12
|
-
"\n",
|
13
|
-
"<b>Implement Viterbi algorithm to find the probability of a word sequence, and the best tag\n",
|
14
|
-
"sequence using Hidden Markov Model.</b>"
|
15
|
-
]
|
16
|
-
},
|
17
|
-
{
|
18
|
-
"cell_type": "code",
|
19
|
-
"execution_count": 31,
|
20
|
-
"id": "b340e65d-d96d-49a1-bf9b-417eb908ad8a",
|
21
|
-
"metadata": {},
|
22
|
-
"outputs": [
|
23
|
-
{
|
24
|
-
"name": "stdout",
|
25
|
-
"output_type": "stream",
|
26
|
-
"text": [
|
27
|
-
"[0.3, 0.4, 0.3]\n",
|
28
|
-
"[0.095, 0.175, 0.08000000000000002]\n",
|
29
|
-
"[0.021249999999999998, 0.06045, 0.0728]\n",
|
30
|
-
"[0.008334999999999999, 0.020425, 0.01209]\n",
|
31
|
-
"propability : 0.04085\n",
|
32
|
-
"[1, 1, 1]\n",
|
33
|
-
"[0.5, 0.5, 0.0]\n",
|
34
|
-
"[0.15, 0.12000000000000001, 0.06999999999999999]\n",
|
35
|
-
"[0.0675, 0.051500000000000004, 0.0]\n",
|
36
|
-
"propability : 0.040850000000000004\n"
|
37
|
-
]
|
38
|
-
}
|
39
|
-
],
|
40
|
-
"source": [
|
41
|
-
"states = ['CIA1', 'CIA2', 'CIA3']\n",
|
42
|
-
"prior = [0.3, 0.4, 0.3]\n",
|
43
|
-
"outputs = ['Good', 'Moderate', 'Poor']\n",
|
44
|
-
"emission = [\n",
|
45
|
-
" [0.5, 0.3, 0.2],\n",
|
46
|
-
" [0.5, 0.4, 0.1],\n",
|
47
|
-
" [0.0, 0.7, 0.3]\n",
|
48
|
-
"]\n",
|
49
|
-
"transition = [\n",
|
50
|
-
" [0.5, 0.5, 0.0],\n",
|
51
|
-
" [0.1, 0.5, 0.4],\n",
|
52
|
-
" [0.0, 0.2, 0.8]\n",
|
53
|
-
"]\n",
|
54
|
-
"seq = \"Good Moderate Good\"\n",
|
55
|
-
"seq = [outputs.index(x) for x in seq.split()]\n",
|
56
|
-
"\n",
|
57
|
-
"def HMMF(transition, emission, prior, seq) :\n",
|
58
|
-
" alpha = prior\n",
|
59
|
-
" states = len(alpha)\n",
|
60
|
-
" for i in range(len(seq)) :\n",
|
61
|
-
" print(alpha)\n",
|
62
|
-
" new_alpha = [sum(transition[s1][s2]*emission[s1][seq[i]]*alpha[s1] for s1 in range(states)) for s2 in range(states)]\n",
|
63
|
-
" alpha = new_alpha\n",
|
64
|
-
" print(alpha)\n",
|
65
|
-
" print(f\"propability : {sum(alpha)}\")\n",
|
66
|
-
"\n",
|
67
|
-
"def HMMB(transition, emission, prior, seq) :\n",
|
68
|
-
" states = len(prior)\n",
|
69
|
-
" beta = [1 for _ in range(states)]\n",
|
70
|
-
" for i in range(len(seq)-1, -1, -1) :\n",
|
71
|
-
" print(beta)\n",
|
72
|
-
" new_beta = [sum(transition[s1][s2]*emission[s1][seq[i]]*beta[s2] for s2 in range(states)) for s1 in range(states)]\n",
|
73
|
-
" beta = new_beta\n",
|
74
|
-
" print(beta)\n",
|
75
|
-
" print(f\"propability : {sum(beta[i]*prior[i] for i in range(states))}\")\n",
|
76
|
-
"\n",
|
77
|
-
"HMMF(transition, emission, prior, seq)\n",
|
78
|
-
"HMMB(transition, emission, prior, seq)\n",
|
79
|
-
" "
|
80
|
-
]
|
81
|
-
},
|
82
|
-
{
|
83
|
-
"cell_type": "code",
|
84
|
-
"execution_count": 47,
|
85
|
-
"id": "ab7154e2-7a14-438f-b6f3-dbd256d6fe9d",
|
86
|
-
"metadata": {},
|
87
|
-
"outputs": [],
|
88
|
-
"source": [
|
89
|
-
"def viterbi(transition, emission, prior, seq, states) :\n",
|
90
|
-
" delta = prior\n",
|
91
|
-
" n = len(prior)\n",
|
92
|
-
" psi = []\n",
|
93
|
-
" for i in range(len(seq)) :\n",
|
94
|
-
" print(delta)\n",
|
95
|
-
" values = [\n",
|
96
|
-
" [delta[s1]*transition[s1][s2]*emission[s1][seq[i]]for s1 in range(n)]\n",
|
97
|
-
" for s2 in range(n)]\n",
|
98
|
-
" new_delta = [max(value) for value in values]\n",
|
99
|
-
" psi.append([values[i].index(new_delta[i]) for i in range(n)])\n",
|
100
|
-
" delta = new_delta\n",
|
101
|
-
" print(delta)\n",
|
102
|
-
" bseq = []\n",
|
103
|
-
" bseq.append(delta.index(max(delta)))\n",
|
104
|
-
" for i in range(len(seq)-1, -1, -1) :\n",
|
105
|
-
" val = psi[i][bseq[-1]]\n",
|
106
|
-
" bseq.append(val)\n",
|
107
|
-
"\n",
|
108
|
-
" print([states[i] for i in bseq[::-1]])\n",
|
109
|
-
" "
|
110
|
-
]
|
111
|
-
},
|
112
|
-
{
|
113
|
-
"cell_type": "code",
|
114
|
-
"execution_count": 48,
|
115
|
-
"id": "aefd1ab7-cf20-4874-bad5-4dc61322a899",
|
116
|
-
"metadata": {},
|
117
|
-
"outputs": [
|
118
|
-
{
|
119
|
-
"name": "stdout",
|
120
|
-
"output_type": "stream",
|
121
|
-
"text": [
|
122
|
-
"[0.3, 0.4, 0.3]\n",
|
123
|
-
"[0.075, 0.1, 0.08000000000000002]\n",
|
124
|
-
"[0.01125, 0.020000000000000004, 0.044800000000000006]\n",
|
125
|
-
"[0.0028125, 0.005000000000000001, 0.004000000000000001]\n",
|
126
|
-
"['CIA2', 'CIA2', 'CIA2', 'CIA2']\n"
|
127
|
-
]
|
128
|
-
}
|
129
|
-
],
|
130
|
-
"source": [
|
131
|
-
"viterbi(transition, emission, prior, seq, states)"
|
132
|
-
]
|
133
|
-
},
|
134
|
-
{
|
135
|
-
"cell_type": "code",
|
136
|
-
"execution_count": null,
|
137
|
-
"id": "fd92c7ae-6d8f-42a7-a95d-5b4a4b4dda9c",
|
138
|
-
"metadata": {},
|
139
|
-
"outputs": [],
|
140
|
-
"source": []
|
141
|
-
}
|
142
|
-
],
|
143
|
-
"metadata": {
|
144
|
-
"kernelspec": {
|
145
|
-
"display_name": "Python 3 (ipykernel)",
|
146
|
-
"language": "python",
|
147
|
-
"name": "python3"
|
148
|
-
},
|
149
|
-
"language_info": {
|
150
|
-
"codemirror_mode": {
|
151
|
-
"name": "ipython",
|
152
|
-
"version": 3
|
153
|
-
},
|
154
|
-
"file_extension": ".py",
|
155
|
-
"mimetype": "text/x-python",
|
156
|
-
"name": "python",
|
157
|
-
"nbconvert_exporter": "python",
|
158
|
-
"pygments_lexer": "ipython3",
|
159
|
-
"version": "3.11.5"
|
160
|
-
}
|
161
|
-
},
|
162
|
-
"nbformat": 4,
|
163
|
-
"nbformat_minor": 5
|
164
|
-
}
|