noshot 0.1.7__py3-none-any.whl → 0.1.8__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-0.1.7.dist-info → noshot-0.1.8.dist-info}/METADATA +2 -2
- noshot-0.1.8.dist-info/RECORD +24 -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.8.dist-info}/LICENSE.txt +0 -0
- {noshot-0.1.7.dist-info → noshot-0.1.8.dist-info}/WHEEL +0 -0
- {noshot-0.1.7.dist-info → noshot-0.1.8.dist-info}/top_level.txt +0 -0
@@ -1,125 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
How to run
|
3
|
-
==========
|
4
|
-
save the file as DHCP.java (filename can be anything)
|
5
|
-
Command Prompt 1 (go to the location the file is saved)
|
6
|
-
javac *.java
|
7
|
-
java Server
|
8
|
-
|
9
|
-
Command Prompt 2 (go to the location the file is saved)
|
10
|
-
java Client
|
11
|
-
*/
|
12
|
-
|
13
|
-
import java.io.*;
|
14
|
-
import java.net.*;
|
15
|
-
import java.util.*;
|
16
|
-
|
17
|
-
class Server{
|
18
|
-
static int SERVER_PORT = 4900;
|
19
|
-
static String SERVER_IP = "127.0.0.1"; // Change to your server's IP
|
20
|
-
static String IP_ALLOCATIONS_FILE = "ip_allocations.txt";
|
21
|
-
static List<String> availableIpAddresses = new ArrayList<>();
|
22
|
-
static Map<String, String> ipAllocations = new HashMap<>();
|
23
|
-
|
24
|
-
public static void main(String[] args){
|
25
|
-
loadIpAllocations(); // Load IP allocations from file (if available)
|
26
|
-
initializeIpAddresses();
|
27
|
-
|
28
|
-
try{
|
29
|
-
DatagramSocket socket = new DatagramSocket(SERVER_PORT);
|
30
|
-
while(true){
|
31
|
-
byte[] receiveData = new byte[1024];
|
32
|
-
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
|
33
|
-
socket.receive(receivePacket);
|
34
|
-
|
35
|
-
InetAddress clientAddress = receivePacket.getAddress();
|
36
|
-
String macAddress = extractMacAddress(receiveData);
|
37
|
-
String allocatedIp = allocateIpAddress(macAddress);
|
38
|
-
|
39
|
-
byte[] responseData = createDHCPResponse(macAddress, allocatedIp);
|
40
|
-
DatagramPacket responsePacket = new DatagramPacket(responseData, responseData.length, clientAddress, receivePacket.getPort());
|
41
|
-
socket.send(responsePacket);
|
42
|
-
|
43
|
-
System.out.println("Allocated IP " + allocatedIp + " to client with MAC " + macAddress);
|
44
|
-
saveIpAllocations();
|
45
|
-
}
|
46
|
-
}catch(Exception e){
|
47
|
-
e.printStackTrace();}
|
48
|
-
}
|
49
|
-
|
50
|
-
private static void initializeIpAddresses(){
|
51
|
-
for(int i = 2; i <= 254; i++)
|
52
|
-
availableIpAddresses.add("192.168.1." + i);
|
53
|
-
}
|
54
|
-
|
55
|
-
private static String extractMacAddress(byte[] data){
|
56
|
-
return "00:11:22:33:44:55";
|
57
|
-
}
|
58
|
-
|
59
|
-
private static String allocateIpAddress(String macAddress){
|
60
|
-
if(availableIpAddresses.isEmpty())
|
61
|
-
return "No available IP addresses";
|
62
|
-
Random random = new Random();
|
63
|
-
int index = random.nextInt(availableIpAddresses.size());
|
64
|
-
String allocatedIp = availableIpAddresses.remove(index);
|
65
|
-
ipAllocations.put(macAddress, allocatedIp);
|
66
|
-
return allocatedIp;
|
67
|
-
}
|
68
|
-
|
69
|
-
private static byte[] createDHCPResponse(String macAddress, String allocatedIp) {
|
70
|
-
// Simulate creating a DHCP response with the allocated IP address
|
71
|
-
// In a real implementation, you'd construct a proper DHCP packet
|
72
|
-
return ("Allocated IP: " + allocatedIp).getBytes();
|
73
|
-
}
|
74
|
-
|
75
|
-
private static void saveIpAllocations() {
|
76
|
-
try(ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(IP_ALLOCATIONS_FILE))){
|
77
|
-
outputStream.writeObject(ipAllocations);
|
78
|
-
System.out.println("Saved IP allocations to " + IP_ALLOCATIONS_FILE);
|
79
|
-
}catch (IOException e){
|
80
|
-
e.printStackTrace();
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
private static void loadIpAllocations() {
|
85
|
-
try(ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(IP_ALLOCATIONS_FILE))){
|
86
|
-
ipAllocations = (HashMap<String, String>) inputStream.readObject();
|
87
|
-
System.out.println("Loaded IP allocations from " + IP_ALLOCATIONS_FILE);
|
88
|
-
}catch(FileNotFoundException e){
|
89
|
-
System.out.println(IP_ALLOCATIONS_FILE + " not found. Starting with an empty IP allocations map.");
|
90
|
-
}catch(IOException | ClassNotFoundException e){
|
91
|
-
e.printStackTrace();
|
92
|
-
}
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
|
97
|
-
class Client{
|
98
|
-
static int SERVER_PORT = 4900;
|
99
|
-
static String SERVER_IP = "127.0.0.1"; // Change to your server's IP
|
100
|
-
|
101
|
-
public static void main(String[] args) {
|
102
|
-
try{
|
103
|
-
DatagramSocket socket = new DatagramSocket();
|
104
|
-
InetAddress serverAddress = InetAddress.getByName(SERVER_IP);
|
105
|
-
|
106
|
-
byte[] requestData = createDHCPRequest("00:11:22:33:44:55"); // Replace with your MAC address
|
107
|
-
DatagramPacket requestPacket = new DatagramPacket(requestData, requestData.length, serverAddress, SERVER_PORT);
|
108
|
-
socket.send(requestPacket);
|
109
|
-
|
110
|
-
byte[] receiveData = new byte[1024];
|
111
|
-
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
|
112
|
-
socket.receive(receivePacket);
|
113
|
-
|
114
|
-
String response = new String(receivePacket.getData()).trim();
|
115
|
-
System.out.println("Received DHCP Response: " + response);
|
116
|
-
}catch(Exception e){
|
117
|
-
e.printStackTrace();
|
118
|
-
}
|
119
|
-
}
|
120
|
-
|
121
|
-
private static byte[] createDHCPRequest(String macAddress) {
|
122
|
-
String request = "DHCP Request with MAC: " + macAddress;
|
123
|
-
return request.getBytes();
|
124
|
-
}
|
125
|
-
}
|
Binary file
|
Binary file
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import nltk
|
2
|
-
import string
|
3
|
-
from nltk.tokenize import word_tokenize
|
4
|
-
from nltk.corpus import stopwords
|
5
|
-
|
6
|
-
#tokenize
|
7
|
-
sentence = "SASTRA University is a great place. It has amazing facilities!"
|
8
|
-
words=nltk.word_tokenize(sentence)
|
9
|
-
print(words)
|
10
|
-
|
11
|
-
#stopwords removal
|
12
|
-
stop_words = set(stopwords.words('english'))
|
13
|
-
words_1=[word for word in words if word not in stop_words]
|
14
|
-
print(words_1)
|
15
|
-
|
16
|
-
#punctuation removal
|
17
|
-
words_2= [word for word in words_1 if word not in string.punctuation]
|
18
|
-
print(words_2)
|
@@ -1,83 +0,0 @@
|
|
1
|
-
import nltk
|
2
|
-
from collections import Counter
|
3
|
-
from nltk.tokenize import word_tokenize
|
4
|
-
from nltk.util import bigrams
|
5
|
-
from nltk.corpus import stopwords
|
6
|
-
import string
|
7
|
-
stop_words=set(stopwords.words('english'))
|
8
|
-
|
9
|
-
def bigram_fun(bigram_count,sentence):
|
10
|
-
sentence=sentence.lower()
|
11
|
-
tokens=word_tokenize(sentence)
|
12
|
-
tokens_new=[token for token in tokens if token not in stop_words and token not in string.punctuation]
|
13
|
-
bigram_list=list(bigrams(tokens_new))
|
14
|
-
for bigram in bigram_list:
|
15
|
-
bigram_count[bigram]=bigram_count.get(bigram,0)+1
|
16
|
-
|
17
|
-
sentences = [
|
18
|
-
"I love studying data science.",
|
19
|
-
"Data science is an interesting field.",
|
20
|
-
"Science requires data for analysis.",
|
21
|
-
"Data is key in modern science.",
|
22
|
-
"Data science helps in business decision-making."
|
23
|
-
]
|
24
|
-
|
25
|
-
bigram_count={}
|
26
|
-
for sentence in sentences:
|
27
|
-
bigram_fun(bigram_count,sentence)
|
28
|
-
|
29
|
-
word1=input("Enter the word1:")
|
30
|
-
word2=input("Enter the word2:")
|
31
|
-
# contingency matrix
|
32
|
-
C = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
|
33
|
-
|
34
|
-
# Updating contingency matrix based on word1 and word2
|
35
|
-
for units in bigram_count:
|
36
|
-
if units[0] == word1 and units[1] == word2:
|
37
|
-
C[0][0] += bigram_count[units] # word1 and word2
|
38
|
-
elif units[0] == word1 and units[1] != word2:
|
39
|
-
C[0][1] += bigram_count[units] # word1 and not word2
|
40
|
-
elif units[0] != word1 and units[1] == word2:
|
41
|
-
C[1][0] += bigram_count[units] # not word1 and word2
|
42
|
-
else:
|
43
|
-
C[1][1] += bigram_count[units] # not word1 and not word2
|
44
|
-
|
45
|
-
# total matrix
|
46
|
-
# Updating contingency matrix based on word1 and word2
|
47
|
-
C[0][2] = C[0][0] + C[0][1]
|
48
|
-
C[1][2] = C[1][0] + C[1][1]
|
49
|
-
C[2][0] = C[0][0] + C[1][0]
|
50
|
-
C[2][1] = C[0][1] + C[1][1]
|
51
|
-
tot = C[2][0] + C[2][1]
|
52
|
-
|
53
|
-
print("Contingency matrix:")
|
54
|
-
for row in C:
|
55
|
-
print(" ".join(str(val) for val in row))
|
56
|
-
|
57
|
-
# expected matrix
|
58
|
-
E = [[0, 0], [0, 0]]
|
59
|
-
|
60
|
-
# Calculate expected values based on contingency matrix and total occurrences
|
61
|
-
E[0][0] = (C[0][2] * C[2][0]) / tot # expected occurrences of word1 and word2
|
62
|
-
E[0][1] = (C[0][2] * C[2][1]) / tot # expected occurrences of word1 and not word2
|
63
|
-
E[1][0] = (C[1][2] * C[2][0]) / tot # expected occurrences of not word1 and word2
|
64
|
-
E[1][1] = (C[1][2] * C[2][1]) / tot # expected occurrences of neither word1 nor word2
|
65
|
-
|
66
|
-
print("Expected matrix:")
|
67
|
-
for row in E:
|
68
|
-
print(" ".join(f"{val:.2f}" for val in row))
|
69
|
-
|
70
|
-
obs_mat = [C[0][0], C[0][1], C[1][0], C[1][1]]
|
71
|
-
exp_mat = [E[0][0], E[0][1], E[1][0], E[1][1]]
|
72
|
-
|
73
|
-
chi2test=0
|
74
|
-
for i in range(4):
|
75
|
-
chi2test+=(obs_mat[i]-exp_mat[i])**2/exp_mat[i] #summation of O-E whole square by E
|
76
|
-
|
77
|
-
cric_val=float(input("Enter critical value:"))
|
78
|
-
|
79
|
-
if(chi2test>cric_val):
|
80
|
-
print("Reject H0")
|
81
|
-
else:
|
82
|
-
print("Accept H0")
|
83
|
-
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import pandas as pd
|
2
|
-
import string
|
3
|
-
import numpy as np
|
4
|
-
from nltk.corpus import stopwords
|
5
|
-
from nltk.tokenize import word_tokenize
|
6
|
-
from nltk.util import bigrams
|
7
|
-
|
8
|
-
|
9
|
-
def unigram_fun(sentence):
|
10
|
-
sentence=sentence.lower()
|
11
|
-
tokens=word_tokenize(sentence)
|
12
|
-
token_1=[token for token in tokens if token not in string.punctuation and token not in stop_words]
|
13
|
-
return token_1
|
14
|
-
|
15
|
-
def bigram_fun(sentence):
|
16
|
-
sentence=sentence.lower()
|
17
|
-
tokens=word_tokenize(sentence)
|
18
|
-
token_1=[token for token in tokens if token not in string.punctuation and token not in stop_words]
|
19
|
-
bigram_list=list(bigrams(token_1))
|
20
|
-
return bigram_list
|
21
|
-
|
22
|
-
|
23
|
-
df=pd.read_csv('sastralines.csv')
|
24
|
-
df_new = df.iloc[:,0]
|
25
|
-
df_new_list = df_new.tolist()
|
26
|
-
stop_words=set(stopwords.words('english'))
|
27
|
-
unigrams=[unigram_fun(sentence) for sentence in df_new_list]
|
28
|
-
bigrams=[bigram_fun(sentence) for sentence in df_new_list]
|
29
|
-
print(df_new_list)
|
30
|
-
|
31
|
-
#Calculaing the length of the corpus
|
32
|
-
N=0
|
33
|
-
for line in df_new_list:
|
34
|
-
N=N+len(line)
|
35
|
-
|
36
|
-
print("The length of the corpus is:",N)
|
37
|
-
|
38
|
-
|
39
|
-
#unigram_dict
|
40
|
-
unigram_dict={}
|
41
|
-
for line in unigrams:
|
42
|
-
for word in line:
|
43
|
-
unigram_dict[word]=0
|
44
|
-
for line in unigrams:
|
45
|
-
for word in line:
|
46
|
-
unigram_dict[word]=unigram_dict[word]+1
|
47
|
-
|
48
|
-
#bigram_dict
|
49
|
-
bigram_dict={}
|
50
|
-
for line in bigrams:
|
51
|
-
for word in line:
|
52
|
-
bigram_dict[word]=0
|
53
|
-
for line in bigrams:
|
54
|
-
for word in line:
|
55
|
-
bigram_dict[word]=bigram_dict[word]+1
|
56
|
-
|
57
|
-
|
58
|
-
a=input("Enter the 1st word:")
|
59
|
-
b=input("Enter the 2nd word:")
|
60
|
-
cv=float(input("Enter the critical value:"))
|
61
|
-
|
62
|
-
#observerd mean
|
63
|
-
O=(bigram_dict[(a,b)]/N)
|
64
|
-
|
65
|
-
#Expected mean
|
66
|
-
E=((unigram_dict[a]/N)*(unigram_dict[b]/N))
|
67
|
-
|
68
|
-
#variance
|
69
|
-
variance=E
|
70
|
-
|
71
|
-
ttest = (O-E)/np.sqrt((variance/N))
|
72
|
-
print(ttest)
|
73
|
-
|
74
|
-
if(ttest<cv):
|
75
|
-
print("Accept H0")
|
76
|
-
else:
|
77
|
-
print("Reject H0")
|
78
|
-
|
79
|
-
# Credit: Raghavender
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import pandas as pd
|
2
|
-
import string
|
3
|
-
import nltk
|
4
|
-
import math
|
5
|
-
from nltk.corpus import stopwords
|
6
|
-
from nltk.tokenize import word_tokenize
|
7
|
-
from collections import defaultdict
|
8
|
-
|
9
|
-
# Load data
|
10
|
-
df = pd.read_csv("Bank.csv")
|
11
|
-
train_data = df.iloc[0:93, :]
|
12
|
-
test_data = df.iloc[94:, :]
|
13
|
-
stop_words = set(stopwords.words('english'))
|
14
|
-
|
15
|
-
# Initialize counters
|
16
|
-
fin_class = riv_class = 0
|
17
|
-
fin_word_freq = defaultdict(int)
|
18
|
-
riv_word_freq = defaultdict(int)
|
19
|
-
|
20
|
-
# Preprocess and count word occurrences per class
|
21
|
-
for _, row in train_data.iterrows():
|
22
|
-
tokens = [word for word in word_tokenize(row['Sentence']) if word not in stop_words and word not in string.punctuation]
|
23
|
-
|
24
|
-
if row['Class'] == 'Financial Institution':
|
25
|
-
fin_class += 1
|
26
|
-
for word in tokens:
|
27
|
-
fin_word_freq[word] += 1
|
28
|
-
elif row['Class'] == 'River Border':
|
29
|
-
riv_class += 1
|
30
|
-
for word in tokens:
|
31
|
-
riv_word_freq[word] += 1
|
32
|
-
|
33
|
-
# Calculate prior probabilities
|
34
|
-
tot_class = fin_class + riv_class
|
35
|
-
prior_fin_class = math.log2(fin_class / tot_class)
|
36
|
-
prior_riv_class = math.log2(riv_class / tot_class)
|
37
|
-
|
38
|
-
# Vocabulary size
|
39
|
-
vocab = set(list(fin_word_freq.keys()) + list(riv_word_freq.keys()))
|
40
|
-
V = len(vocab)
|
41
|
-
|
42
|
-
# Test phase
|
43
|
-
for _, row in test_data.iterrows():
|
44
|
-
tokens = [word for word in word_tokenize(row['Sentence']) if word not in stop_words and word not in string.punctuation]
|
45
|
-
|
46
|
-
score_fin = prior_fin_class
|
47
|
-
score_riv = prior_riv_class
|
48
|
-
|
49
|
-
for word in tokens:
|
50
|
-
score_fin += math.log2(fin_word_freq[word] + 1) - math.log2(fin_class + V)
|
51
|
-
score_riv += math.log2(riv_word_freq[word] + 1) - math.log2(riv_class + V)
|
52
|
-
|
53
|
-
print("Sense is Financial Institution" if score_fin > score_riv else "Sense is River Border")
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import nltk
|
2
|
-
import math
|
3
|
-
import string
|
4
|
-
from collections import defaultdict
|
5
|
-
from nltk.tokenize import word_tokenize
|
6
|
-
from nltk.corpus import stopwords
|
7
|
-
from nltk import bigrams
|
8
|
-
|
9
|
-
# Input for preposition, noun, and verb
|
10
|
-
prep = input("Enter the preposition: ").lower()
|
11
|
-
noun = input("Enter the noun: ").lower()
|
12
|
-
verb = input("Enter the verb: ").lower()
|
13
|
-
|
14
|
-
# Stopwords and punctuation setup
|
15
|
-
stop_words = set(stopwords.words('english'))
|
16
|
-
|
17
|
-
# Using defaultdict to avoid manual key checking
|
18
|
-
unigram_dict = defaultdict(int)
|
19
|
-
bigram_dict = defaultdict(int)
|
20
|
-
|
21
|
-
# List of sentences to analyze
|
22
|
-
sentences = [
|
23
|
-
"Saw the phone with me.",
|
24
|
-
"Went to the meeting yesterday.",
|
25
|
-
"Told the man to wait.",
|
26
|
-
"Gave the book to her.",
|
27
|
-
"Saw the cat with her."
|
28
|
-
]
|
29
|
-
|
30
|
-
# Processing each sentence
|
31
|
-
for sentence in sentences:
|
32
|
-
tokens = word_tokenize(sentence)
|
33
|
-
tokens_cleaned = [token.lower() for token in tokens if token.lower() not in stop_words and token not in string.punctuation]
|
34
|
-
|
35
|
-
# Counting unigrams
|
36
|
-
for word in tokens_cleaned:
|
37
|
-
unigram_dict[word] += 1
|
38
|
-
|
39
|
-
# Counting bigrams
|
40
|
-
for bg in bigrams(tokens_cleaned):
|
41
|
-
bigram_dict[bg] += 1
|
42
|
-
|
43
|
-
# Default values for unseen bigrams/unigrams
|
44
|
-
p_noun_prep = bigram_dict[(noun, prep)] / unigram_dict[noun] if unigram_dict[noun] != 0 else 0
|
45
|
-
p_verb_prep = bigram_dict[(verb, prep)] / unigram_dict[verb] if unigram_dict[verb] != 0 else 0
|
46
|
-
p_0_n = 1 - p_noun_prep
|
47
|
-
|
48
|
-
# Ensure that the log argument is valid
|
49
|
-
if p_noun_prep > 0 and p_verb_prep * p_0_n > 0:
|
50
|
-
lammbda = math.log2((p_verb_prep * p_0_n) / p_noun_prep)
|
51
|
-
print("Attached with Verb." if lammbda >= 0 else "Attached with Noun.")
|
52
|
-
else:
|
53
|
-
print("No valid attachments.")
|
@@ -1,82 +0,0 @@
|
|
1
|
-
emission_probs = {'A': {'K': 0.4, 'T': 0.5}, 'B': {'K': 0.3, 'T': 0.3}}
|
2
|
-
alpha_a = 1
|
3
|
-
alpha_b = 0
|
4
|
-
alpha_A = [alpha_a]
|
5
|
-
alpha_B = [alpha_b]
|
6
|
-
|
7
|
-
visible_states = ['K', 'T','K'] # Update with the actual visible states
|
8
|
-
|
9
|
-
for state in visible_states:
|
10
|
-
old_alpha = alpha_a
|
11
|
-
alpha_a = (alpha_a * 0.2 * emission_probs["A"][state]) + (alpha_b * 0.6 * emission_probs["B"][state])
|
12
|
-
alpha_b = (old_alpha * 0.8 * emission_probs["A"][state]) + (alpha_b * 0.4 * emission_probs["B"][state])
|
13
|
-
alpha_A.append(alpha_a)
|
14
|
-
alpha_B.append(alpha_b)
|
15
|
-
|
16
|
-
print(alpha_A)
|
17
|
-
print(alpha_B)
|
18
|
-
|
19
|
-
# B. BACKWARD PROCEDURE
|
20
|
-
# Credit: Ahmed Baari
|
21
|
-
# Backward
|
22
|
-
emission_probs = {
|
23
|
-
'A': {'K': 0.4, 'T': 0.5},
|
24
|
-
'B': {'K': 0.3, 'T': 0.3}
|
25
|
-
}
|
26
|
-
|
27
|
-
b_A = 1
|
28
|
-
b_B = 1
|
29
|
-
beta_A = [b_A]
|
30
|
-
beta_B = [b_B]
|
31
|
-
|
32
|
-
for state in reversed(visible_states):
|
33
|
-
old_bA = b_A
|
34
|
-
old_bB = b_B
|
35
|
-
|
36
|
-
b_A = (
|
37
|
-
b_A * 0.2 * emission_probs["A"][state]
|
38
|
-
) + (
|
39
|
-
b_B * 0.8 * emission_probs["A"][state]
|
40
|
-
)
|
41
|
-
|
42
|
-
b_B = (
|
43
|
-
old_bA * 0.6 * emission_probs["B"][state]
|
44
|
-
) + (
|
45
|
-
old_bB * 0.4 * emission_probs["B"][state]
|
46
|
-
)
|
47
|
-
|
48
|
-
beta_A.append(b_A)
|
49
|
-
beta_B.append(b_B)
|
50
|
-
|
51
|
-
beta_A, beta_B
|
52
|
-
|
53
|
-
|
54
|
-
# C. BEST STATE SEQUENCE
|
55
|
-
# Credit: Ahmed Baari
|
56
|
-
gamma_A = []
|
57
|
-
gamma_B = []
|
58
|
-
|
59
|
-
# alpha * beta of A / that of A + that of B
|
60
|
-
|
61
|
-
for i in range(3):
|
62
|
-
g_A = (
|
63
|
-
alpha_A[i] * beta_A[i]
|
64
|
-
) / (
|
65
|
-
alpha_A[i]*beta_A[i] + alpha_B[i]*beta_B[i]
|
66
|
-
)
|
67
|
-
g_B = (
|
68
|
-
alpha_B[i] * beta_B[i]
|
69
|
-
) / (
|
70
|
-
alpha_B[i] * beta_B[i] + alpha_A[i] + beta_A[i]
|
71
|
-
)
|
72
|
-
|
73
|
-
gamma_A.append(g_A)
|
74
|
-
gamma_B.append(g_B)
|
75
|
-
|
76
|
-
for i in range(3):
|
77
|
-
print(
|
78
|
-
"A" if gamma_A[i] > gamma_B[i] else "B",
|
79
|
-
end=" "
|
80
|
-
)
|
81
|
-
|
82
|
-
#
|
@@ -1,16 +0,0 @@
|
|
1
|
-
emission_probs = {
|
2
|
-
"CP": {"cola": 0.6, "ice_tea": 0.1, "lem": 0.3},
|
3
|
-
"IP": {"cola": 0.1, "ice_tea": 0.7, "lem": 0.2}
|
4
|
-
}
|
5
|
-
alpha_a = 1
|
6
|
-
alpha_b = 0
|
7
|
-
|
8
|
-
for _ in range(3):
|
9
|
-
state = input("Enter the state:")
|
10
|
-
alpha_a = max(alpha_a * 0.7 * emission_probs["CP"][state],
|
11
|
-
alpha_b * 0.5 * emission_probs["IP"][state])
|
12
|
-
|
13
|
-
alpha_b = max(alpha_a * 0.3 * emission_probs["CP"][state],
|
14
|
-
alpha_b * 0.5 * emission_probs["IP"][state])
|
15
|
-
print(alpha_a, alpha_b)
|
16
|
-
print("CP" if alpha_a > alpha_b else "IP")
|
@@ -1,15 +0,0 @@
|
|
1
|
-
from nltk import PCFG, InsideChartParser
|
2
|
-
grammar = PCFG.fromstring("""
|
3
|
-
S -> NP VP [1.0]
|
4
|
-
NP -> NP PP [0.4] | 'he' [0.1] | 'dessert' [0.3] | 'lunch' [0.1] | 'saw' [0.1]
|
5
|
-
PP -> Pre NP [1.0]
|
6
|
-
VP -> Verb NP [0.3] | VP PP [0.7]
|
7
|
-
Pre -> 'with' [0.6] | 'in' [0.4]
|
8
|
-
Verb -> 'ate' [0.7] | 'saw' [0.3]
|
9
|
-
""")
|
10
|
-
parser = InsideChartParser(grammar)
|
11
|
-
tokens = "he saw lunch with dessert".split()
|
12
|
-
for tree in parser.parse(tokens):
|
13
|
-
tree.pretty_print()
|
14
|
-
print("PROBABILITY: ",tree.prob())
|
15
|
-
#tree.draw()
|