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,95 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "b5d46296-1714-4d28-b99b-02403662e645",
|
7
|
-
"metadata": {},
|
8
|
-
"outputs": [],
|
9
|
-
"source": [
|
10
|
-
"from random import randint as rint\n",
|
11
|
-
"n = 8\n",
|
12
|
-
"def show(b):\n",
|
13
|
-
" board = [['_'] * n for _ in range(n)]\n",
|
14
|
-
" for i in range(n):\n",
|
15
|
-
" board[int(b[i])-1][i] = 'Q'\n",
|
16
|
-
" print(f\" {' '.join(['_']*n)}\")\n",
|
17
|
-
" for i in board:\n",
|
18
|
-
" print(f\"|{'|'.join(i)}|\")\n",
|
19
|
-
"def mutate(b1, b2):\n",
|
20
|
-
" b1, b2 = list(b1), list(b2)\n",
|
21
|
-
" x, y = rint(0,n-1), rint(0,n-1)\n",
|
22
|
-
" b1[x], b2[x] = b2[x], b1[x]\n",
|
23
|
-
" b1[y] = str(int(y) + 1)\n",
|
24
|
-
" return (''.join(b1),''.join(b2))\n",
|
25
|
-
"def crossover(b1, b2):\n",
|
26
|
-
" b1, b2 = list(b1), list(b2)\n",
|
27
|
-
" x = rint(1,n-1)\n",
|
28
|
-
" b1[0:x], b2[0:x] = b2[0:x], b1[0:x]\n",
|
29
|
-
" return (''.join(b1), ''.join(b2))\n",
|
30
|
-
"def fitness(b):\n",
|
31
|
-
" b = list(b)\n",
|
32
|
-
" attacks = 0\n",
|
33
|
-
" for i in range(n):\n",
|
34
|
-
" for j in range(i+1, n):\n",
|
35
|
-
" if b[i] == b[j] or abs(int(b[i]) - int(b[j])) == j - i:\n",
|
36
|
-
" attacks += 1\n",
|
37
|
-
" return attacks\n",
|
38
|
-
"def genetic(gen, pop):\n",
|
39
|
-
" global n \n",
|
40
|
-
" n = len(pop[0])\n",
|
41
|
-
" pq = pop\n",
|
42
|
-
" for i in range(1,gen+1):\n",
|
43
|
-
" pq.sort(key = lambda x : fitness(x))\n",
|
44
|
-
" b1 = pq.pop(0)\n",
|
45
|
-
" b2 = pq.pop(0)\n",
|
46
|
-
" pq.clear()\n",
|
47
|
-
" if fitness(b1) == 0:\n",
|
48
|
-
" print(\"Goal State:\",b1,\"Generation:\",i)\n",
|
49
|
-
" show(b1)\n",
|
50
|
-
" return\n",
|
51
|
-
" x1, x2 = crossover(b1, b2)\n",
|
52
|
-
" x3, x4 = crossover(b2, b1)\n",
|
53
|
-
" pq = [x1, x2, x3, x4, *mutate(x1, x2), *mutate(x2, x1), b1, b2]\n",
|
54
|
-
" print(\"Most Evolved State:\",pq[0],\"Generation:\",i,\"Attacks:\",fitness(pq[0]))\n",
|
55
|
-
" show(pq[0])\n",
|
56
|
-
"\n",
|
57
|
-
"def main():\n",
|
58
|
-
" #no of queens is inferred in genetic()\n",
|
59
|
-
" print(\"Genetic Algorithm Example 1(5 Queen): \")\n",
|
60
|
-
" genetic(1000, [\"32152\",\"24345\"])\n",
|
61
|
-
" print()\n",
|
62
|
-
" print(\"Genetic Algorithm Example 2(8 Queen): \")\n",
|
63
|
-
" genetic(1000, [\"57142860\",\"56782463\"])\n",
|
64
|
-
"\n",
|
65
|
-
" #Sample output\n",
|
66
|
-
" #Genetic Algorithm Example 1(5 Queen): \n",
|
67
|
-
" #Most Evolved State: 14352 Generation: 1000 Attacks: 2\n",
|
68
|
-
" #Genetic Algorithm Example 2(8 Queen): \n",
|
69
|
-
" #Goal State: 57142863 Generation: 1\n",
|
70
|
-
"main()"
|
71
|
-
]
|
72
|
-
}
|
73
|
-
],
|
74
|
-
"metadata": {
|
75
|
-
"kernelspec": {
|
76
|
-
"display_name": "Python 3 (ipykernel)",
|
77
|
-
"language": "python",
|
78
|
-
"name": "python3"
|
79
|
-
},
|
80
|
-
"language_info": {
|
81
|
-
"codemirror_mode": {
|
82
|
-
"name": "ipython",
|
83
|
-
"version": 3
|
84
|
-
},
|
85
|
-
"file_extension": ".py",
|
86
|
-
"mimetype": "text/x-python",
|
87
|
-
"name": "python",
|
88
|
-
"nbconvert_exporter": "python",
|
89
|
-
"pygments_lexer": "ipython3",
|
90
|
-
"version": "3.12.4"
|
91
|
-
}
|
92
|
-
},
|
93
|
-
"nbformat": 4,
|
94
|
-
"nbformat_minor": 5
|
95
|
-
}
|
@@ -1,74 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "1fbe1abb-5a71-4dce-99dc-efbab49656dd",
|
7
|
-
"metadata": {},
|
8
|
-
"outputs": [],
|
9
|
-
"source": [
|
10
|
-
"import math\n",
|
11
|
-
"import random\n",
|
12
|
-
"def simulated_annealing(initsol, inittemp, alpha, iters):\n",
|
13
|
-
" currsol = initsol\n",
|
14
|
-
" cost = fcost(currsol)\n",
|
15
|
-
" sol = currsol\n",
|
16
|
-
" mincost = cost\n",
|
17
|
-
" temp = inittemp\n",
|
18
|
-
" for iteration in range(iters):\n",
|
19
|
-
" neighbor = successors(currsol)\n",
|
20
|
-
" ncost = fcost(neighbor)\n",
|
21
|
-
" costdiff = ncost - cost\n",
|
22
|
-
" if costdiff < 0 or random.random() < math.exp(-costdiff/temp):\n",
|
23
|
-
" currsol = neighbor\n",
|
24
|
-
" cost = ncost\n",
|
25
|
-
" if cost < mincost:\n",
|
26
|
-
" sol = currsol\n",
|
27
|
-
" mincost = cost\n",
|
28
|
-
" temp *= alpha\n",
|
29
|
-
" return sol, mincost\n",
|
30
|
-
"def fcost(sol):\n",
|
31
|
-
" return sum([i**2 for i in sol])\n",
|
32
|
-
"def successors(sol, step = 1.0):\n",
|
33
|
-
" succ = [x + random.uniform(-step,step) for x in sol]\n",
|
34
|
-
" return succ\n",
|
35
|
-
"\n",
|
36
|
-
"def main():\n",
|
37
|
-
" initsol = [300.0, 400.0]\n",
|
38
|
-
" inittemp = 1000.0\n",
|
39
|
-
" alpha = 0.95\n",
|
40
|
-
" iters = 500\n",
|
41
|
-
" \n",
|
42
|
-
" bestsol, cost = simulated_annealing(initsol, inittemp, alpha, iters)\n",
|
43
|
-
" print(\"Best Solution:\",bestsol)\n",
|
44
|
-
" print(\"Best Cost:\",cost)\n",
|
45
|
-
"\n",
|
46
|
-
" #Sample input/output (can change due to the use of random)\n",
|
47
|
-
" #Best Solution: [225.56303970871514, 294.69364950481685]\n",
|
48
|
-
" #Best Cost: 137723.03194110325\n",
|
49
|
-
"main()"
|
50
|
-
]
|
51
|
-
}
|
52
|
-
],
|
53
|
-
"metadata": {
|
54
|
-
"kernelspec": {
|
55
|
-
"display_name": "Python 3 (ipykernel)",
|
56
|
-
"language": "python",
|
57
|
-
"name": "python3"
|
58
|
-
},
|
59
|
-
"language_info": {
|
60
|
-
"codemirror_mode": {
|
61
|
-
"name": "ipython",
|
62
|
-
"version": 3
|
63
|
-
},
|
64
|
-
"file_extension": ".py",
|
65
|
-
"mimetype": "text/x-python",
|
66
|
-
"name": "python",
|
67
|
-
"nbconvert_exporter": "python",
|
68
|
-
"pygments_lexer": "ipython3",
|
69
|
-
"version": "3.12.4"
|
70
|
-
}
|
71
|
-
},
|
72
|
-
"nbformat": 4,
|
73
|
-
"nbformat_minor": 5
|
74
|
-
}
|
@@ -1,103 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "3686dceb-7ecd-40c8-8f9c-eab71bd40f11",
|
7
|
-
"metadata": {
|
8
|
-
"scrolled": true
|
9
|
-
},
|
10
|
-
"outputs": [],
|
11
|
-
"source": [
|
12
|
-
"import math \n",
|
13
|
-
"import random\n",
|
14
|
-
"def display(board):\n",
|
15
|
-
" for row in board:\n",
|
16
|
-
" print(' '.join(str(num) if num != 0 else '.' for num in row))\n",
|
17
|
-
" print()\n",
|
18
|
-
"def fill(board):\n",
|
19
|
-
" for i in range(9):\n",
|
20
|
-
" choices = list(set(range(1,10)) - set(board[i]) - {0})\n",
|
21
|
-
" random.shuffle(choices)\n",
|
22
|
-
" for j in range(9):\n",
|
23
|
-
" if board[i][j] == 0:\n",
|
24
|
-
" board[i][j] = choices.pop()\n",
|
25
|
-
"def cost(board):\n",
|
26
|
-
" conflicts = 0\n",
|
27
|
-
" for n in range(9):\n",
|
28
|
-
" row = board[n]\n",
|
29
|
-
" col = [x[n] for x in board]\n",
|
30
|
-
" conflicts += len(row) - len(set(row))\n",
|
31
|
-
" conflicts += len(col) - len(set(col))\n",
|
32
|
-
" for l in [0,3,6]:\n",
|
33
|
-
" for k in [0,3,6]:\n",
|
34
|
-
" block = []\n",
|
35
|
-
" for i in range(0+l,3+l):\n",
|
36
|
-
" for j in range(0+k,3+k):\n",
|
37
|
-
" block.append(board[i][j])\n",
|
38
|
-
" conflicts += 9 - len(set(block))\n",
|
39
|
-
" return conflicts\n",
|
40
|
-
"def next(board, fixed):\n",
|
41
|
-
" neighbor = [[x for x in row] for row in board]\n",
|
42
|
-
" i = random.randint(0,8)\n",
|
43
|
-
" cols = [j for j in range(9) if (i,j) not in fixed]\n",
|
44
|
-
" if len(cols) >= 2:\n",
|
45
|
-
" j1, j2 = random.sample(cols, 2)\n",
|
46
|
-
" neighbor[i][j1], neighbor[i][j2] = neighbor[i][j2], neighbor[i][j1]\n",
|
47
|
-
" return neighbor\n",
|
48
|
-
"def simulated_annealing(board, initial_temp = 1.0, cooling_rate = 0.99, min_temp = 0.001):\n",
|
49
|
-
" fixed = [(x,y) for x in range(9) for y in range(9) if board[x][y] != 0]\n",
|
50
|
-
" fill(board)\n",
|
51
|
-
" current = best = board\n",
|
52
|
-
" temp = initial_temp\n",
|
53
|
-
" while temp > min_temp:\n",
|
54
|
-
" neighbor = next(current,fixed)\n",
|
55
|
-
" delta = cost(neighbor) - cost(current)\n",
|
56
|
-
" if delta < 0:\n",
|
57
|
-
" current = neighbor\n",
|
58
|
-
" if cost(neighbor) < cost(best):\n",
|
59
|
-
" best = neighbor\n",
|
60
|
-
" else:\n",
|
61
|
-
" if random.random() < math.exp(-delta/temp):\n",
|
62
|
-
" current = neighbor\n",
|
63
|
-
" temp *= cooling_rate\n",
|
64
|
-
" print(f\"Sudoku ({'Best Possible State | Attacks = '+str(cost(best)) if cost(best) else 'Solved'})\") \n",
|
65
|
-
" display(best)\n",
|
66
|
-
"\n",
|
67
|
-
"def main():\n",
|
68
|
-
" board =[[5, 3, 0, 0, 7, 0, 0, 0, 0],\n",
|
69
|
-
" [6, 0, 0, 1, 9, 5, 0, 0, 0],\n",
|
70
|
-
" [0, 9, 8, 0, 0, 0, 0, 6, 0],\n",
|
71
|
-
" [8, 0, 0, 0, 6, 0, 0, 0, 3],\n",
|
72
|
-
" [4, 0, 0, 8, 0, 3, 0, 0, 1],\n",
|
73
|
-
" [7, 0, 0, 0, 2, 0, 0, 0, 6],\n",
|
74
|
-
" [0, 6, 0, 0, 0, 0, 2, 8, 0],\n",
|
75
|
-
" [0, 0, 0, 4, 1, 9, 0, 0, 5],\n",
|
76
|
-
" [0, 0, 0, 0, 8, 0, 0, 7, 9]]\n",
|
77
|
-
" simulated_annealing(board) \n",
|
78
|
-
"main()"
|
79
|
-
]
|
80
|
-
}
|
81
|
-
],
|
82
|
-
"metadata": {
|
83
|
-
"kernelspec": {
|
84
|
-
"display_name": "Python 3 (ipykernel)",
|
85
|
-
"language": "python",
|
86
|
-
"name": "python3"
|
87
|
-
},
|
88
|
-
"language_info": {
|
89
|
-
"codemirror_mode": {
|
90
|
-
"name": "ipython",
|
91
|
-
"version": 3
|
92
|
-
},
|
93
|
-
"file_extension": ".py",
|
94
|
-
"mimetype": "text/x-python",
|
95
|
-
"name": "python",
|
96
|
-
"nbconvert_exporter": "python",
|
97
|
-
"pygments_lexer": "ipython3",
|
98
|
-
"version": "3.12.4"
|
99
|
-
}
|
100
|
-
},
|
101
|
-
"nbformat": 4,
|
102
|
-
"nbformat_minor": 5
|
103
|
-
}
|
@@ -1,182 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "1ff278f1-8592-427e-b72a-032f21aa02e5",
|
7
|
-
"metadata": {},
|
8
|
-
"outputs": [],
|
9
|
-
"source": [
|
10
|
-
"import networkx as nx\n",
|
11
|
-
"import matplotlib.pyplot as plt\n",
|
12
|
-
"def show_tree(graph):\n",
|
13
|
-
" graph = {node : [adj for adj in graph[node]] for node in graph}\n",
|
14
|
-
" terminal_nodes = set()\n",
|
15
|
-
" for node in graph:\n",
|
16
|
-
" for i in range(len(graph[node])):\n",
|
17
|
-
" x = str(graph[node][i])\n",
|
18
|
-
" if x.isdigit():\n",
|
19
|
-
" while x in terminal_nodes:\n",
|
20
|
-
" x+=\" \"\n",
|
21
|
-
" graph[node][i] = x\n",
|
22
|
-
" terminal_nodes.add(x)\n",
|
23
|
-
" g = nx.DiGraph(graph)\n",
|
24
|
-
" levels = nx.single_source_shortest_path_length(g, next(iter(g.nodes)))\n",
|
25
|
-
" layers = {}\n",
|
26
|
-
" for node, level in levels.items():\n",
|
27
|
-
" layers[level] = layers.get(level, []) + [node]\n",
|
28
|
-
" pos = {}\n",
|
29
|
-
" for level, nodes in layers.items():\n",
|
30
|
-
" x_offset = (len(nodes) - 1)/2\n",
|
31
|
-
" for i, node in enumerate(nodes):\n",
|
32
|
-
" x = i - x_offset\n",
|
33
|
-
" y = -level\n",
|
34
|
-
" pos[node] = (x,y)\n",
|
35
|
-
" plt.figure(figsize = (8,4))\n",
|
36
|
-
" nx.draw(g, pos, with_labels = True, \n",
|
37
|
-
" node_size = 600, node_color = 'lightgreen',\n",
|
38
|
-
" font_size = 12, font_family = 'cursive',\n",
|
39
|
-
" arrows = False, width = 1.5, edge_color = 'red',\n",
|
40
|
-
" edgecolors = 'black', linewidths = 1.5,\n",
|
41
|
-
" margins = 0.1, clip_on = False)\n",
|
42
|
-
" plt.suptitle(\"Alpha Beta Pruning\")\n",
|
43
|
-
" plt.show()\n",
|
44
|
-
" plt.clf()\n",
|
45
|
-
"MIN = -float('inf')\n",
|
46
|
-
"MAX = float('inf')\n",
|
47
|
-
"def alphabeta(node, graph, ismax, pruned = [], alpha = MIN, beta = MAX, path = {}):\n",
|
48
|
-
" if str(node).isdigit():\n",
|
49
|
-
" return int(node), pruned, path\n",
|
50
|
-
" option = MIN if ismax else MAX\n",
|
51
|
-
" for child in graph[node]:\n",
|
52
|
-
" val, _, _ = alphabeta(child, graph, not ismax, pruned, alpha, beta, path)\n",
|
53
|
-
" if ismax:\n",
|
54
|
-
" option = max(option, val)\n",
|
55
|
-
" alpha = max(option, alpha)\n",
|
56
|
-
" path[node] = alpha\n",
|
57
|
-
" else:\n",
|
58
|
-
" option = min(option, val)\n",
|
59
|
-
" beta = min(option, beta)\n",
|
60
|
-
" path[node] = beta\n",
|
61
|
-
" if alpha >= beta:\n",
|
62
|
-
" i = graph[node].index(child)+1\n",
|
63
|
-
" pruned += [f\"{node}-{adj}\" for adj in graph[node][i:]]\n",
|
64
|
-
" break\n",
|
65
|
-
" return option, pruned, path\n",
|
66
|
-
"def show_path(node, graph, path, value):\n",
|
67
|
-
" for adj in graph[node]:\n",
|
68
|
-
" if str(adj).isdigit():\n",
|
69
|
-
" return [node,str(value)]\n",
|
70
|
-
" if path[adj] == value:\n",
|
71
|
-
" return [node] + show_path(adj, graph, path, value)\n",
|
72
|
-
"def get_graph():\n",
|
73
|
-
" graph = {}\n",
|
74
|
-
" print(\"Enter edge (u, v)\")\n",
|
75
|
-
" print(\"[PRESS ENTER TO STOP]\")\n",
|
76
|
-
" x = input()\n",
|
77
|
-
" while x:\n",
|
78
|
-
" x = x.split(maxsplit = 1)\n",
|
79
|
-
" u, adj = x[0], [v.strip() for v in x[1].strip(' []').split(',') if v]\n",
|
80
|
-
" graph[u] = graph.get(u,[]) + adj\n",
|
81
|
-
" x = input()\n",
|
82
|
-
" return graph\n",
|
83
|
-
"def example():\n",
|
84
|
-
" graph = {\n",
|
85
|
-
" 'A' : ['B', 'C'],\n",
|
86
|
-
" 'B' : ['D', 'E'],\n",
|
87
|
-
" 'C' : ['F', 'G'],\n",
|
88
|
-
" 'D' : ['H', 'I'],\n",
|
89
|
-
" 'E' : [10, 5],\n",
|
90
|
-
" 'F' : ['J', 'K'],\n",
|
91
|
-
" 'G' : ['L', 'M'],\n",
|
92
|
-
" 'H' : [11, 12],\n",
|
93
|
-
" 'I' : [8, 9],\n",
|
94
|
-
" 'J' : [8, 5],\n",
|
95
|
-
" 'K' : [12, 11],\n",
|
96
|
-
" 'L' : [12, 9],\n",
|
97
|
-
" 'M' : [8, 7]}\n",
|
98
|
-
"\n",
|
99
|
-
" show_tree(graph)\n",
|
100
|
-
" print(graph)\n",
|
101
|
-
" start = 'A'\n",
|
102
|
-
" \n",
|
103
|
-
" val, pruned, path = alphabeta(start, graph, True)#True means first node is max\n",
|
104
|
-
" path = show_path(start, graph, path, val)\n",
|
105
|
-
" print(\"Alpha Beta Pruning(Maximize):\", val, \" Pruned Branches:\", (', '.join(pruned) if pruned else None), \" Path:\",'->'.join(path))\n",
|
106
|
-
" \n",
|
107
|
-
" val, pruned, path = alphabeta(start, graph, False)#False means first node is min\n",
|
108
|
-
" path = show_path(start, graph, path, val)\n",
|
109
|
-
" print(\"Alpha Beta Pruning(Minimize):\", val, \" Pruned Branches:\", (', '.join(pruned) if pruned else None), \" Path:\",'->'.join(path))\n",
|
110
|
-
"\n",
|
111
|
-
"def main():\n",
|
112
|
-
" #example();return #change the example according to question\n",
|
113
|
-
" graph = get_graph()\n",
|
114
|
-
" start = input(\"Enter start node: \")\n",
|
115
|
-
" show_tree(graph)\n",
|
116
|
-
" print(graph)\n",
|
117
|
-
" val, pruned, path = alphabeta(start, graph, True)#True means first node is max\n",
|
118
|
-
" path = show_path(start, graph, path, val)\n",
|
119
|
-
" print(\"Alpha Beta Pruning(Maximize):\", val, \" Pruned Branches:\", (', '.join(pruned) if pruned else None), \" Path:\",'->'.join(path))\n",
|
120
|
-
" \n",
|
121
|
-
" val, pruned, path = alphabeta(start, graph, False)#False means first node is min\n",
|
122
|
-
" path = show_path(start, graph, path, val)\n",
|
123
|
-
" print(\"Alpha Beta Pruning(Minimize):\", val, \" Pruned Branches:\", (', '.join(pruned) if pruned else None), \" Path:\",'->'.join(path))\n",
|
124
|
-
" #Sample output\n",
|
125
|
-
" #Enter edge (u, v)\n",
|
126
|
-
" #[PRESS ENTER TO STOP]\n",
|
127
|
-
" #A B\n",
|
128
|
-
" #A C\n",
|
129
|
-
" #B D\n",
|
130
|
-
" #B E\n",
|
131
|
-
" #C F\n",
|
132
|
-
" #C G\n",
|
133
|
-
" #D H\n",
|
134
|
-
" #D I\n",
|
135
|
-
" #E 10\n",
|
136
|
-
" #E 5\n",
|
137
|
-
" #F J\n",
|
138
|
-
" #F K\n",
|
139
|
-
" #G L\n",
|
140
|
-
" #G M\n",
|
141
|
-
" #H 11\n",
|
142
|
-
" #H 12\n",
|
143
|
-
" #I 8\n",
|
144
|
-
" #I 9\n",
|
145
|
-
" #J 8\n",
|
146
|
-
" #J 5\n",
|
147
|
-
" #K 12\n",
|
148
|
-
" #K 11\n",
|
149
|
-
" #L 12\n",
|
150
|
-
" #L 9\n",
|
151
|
-
" #M 8\n",
|
152
|
-
" #M 7\n",
|
153
|
-
"\n",
|
154
|
-
" #Alpha Beta Pruning(Maximize): 10 Pruned Branches: I-9, J-5, M-7 Path: A->B->E->10\n",
|
155
|
-
" #Alpha Beta Pruning(Minimize): 8 Pruned Branches: I-9, J-5, M-7, K-11, L-9 Path: A->C->F->J->8\n",
|
156
|
-
"\n",
|
157
|
-
"main()"
|
158
|
-
]
|
159
|
-
}
|
160
|
-
],
|
161
|
-
"metadata": {
|
162
|
-
"kernelspec": {
|
163
|
-
"display_name": "Python 3 (ipykernel)",
|
164
|
-
"language": "python",
|
165
|
-
"name": "python3"
|
166
|
-
},
|
167
|
-
"language_info": {
|
168
|
-
"codemirror_mode": {
|
169
|
-
"name": "ipython",
|
170
|
-
"version": 3
|
171
|
-
},
|
172
|
-
"file_extension": ".py",
|
173
|
-
"mimetype": "text/x-python",
|
174
|
-
"name": "python",
|
175
|
-
"nbconvert_exporter": "python",
|
176
|
-
"pygments_lexer": "ipython3",
|
177
|
-
"version": "3.12.4"
|
178
|
-
}
|
179
|
-
},
|
180
|
-
"nbformat": 4,
|
181
|
-
"nbformat_minor": 5
|
182
|
-
}
|
noshot/data/ML TS XAI/AIDS/6. Consraint Satisfaction Problems (CSP)/(A) CSP House Allocation.ipynb
DELETED
@@ -1,120 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "5136c471-9d1d-4b2b-8f6b-e584ea42a133",
|
7
|
-
"metadata": {},
|
8
|
-
"outputs": [],
|
9
|
-
"source": [
|
10
|
-
"import networkx as nx\n",
|
11
|
-
"import matplotlib.pyplot as plt\n",
|
12
|
-
"def check(assign, loc):\n",
|
13
|
-
" #constraints given in the question\n",
|
14
|
-
" #change it accordinly\n",
|
15
|
-
"\n",
|
16
|
-
" a = assign['A']\n",
|
17
|
-
" b = assign['B']\n",
|
18
|
-
" c = assign['C']\n",
|
19
|
-
" d = assign['D']\n",
|
20
|
-
" \n",
|
21
|
-
" #1. C lives in a house higher than D\n",
|
22
|
-
" if c != -1 and d != -1 and c < d:return False\n",
|
23
|
-
"\n",
|
24
|
-
" #2. D lives next to A in Lower number House\n",
|
25
|
-
" if d != -1 and a != -1 and (a - d) != 1:return False\n",
|
26
|
-
"\n",
|
27
|
-
" #3. There is at least one house between D and B \n",
|
28
|
-
" if d != -1 and b != -1 and abs(d - b) == 1:return False\n",
|
29
|
-
"\n",
|
30
|
-
" #4. C doesn't live in house number 3\n",
|
31
|
-
" if c != -1 and c == 3:return False\n",
|
32
|
-
"\n",
|
33
|
-
" #5. B doesn't live in house number 1\n",
|
34
|
-
" if b != -1 and b == 1:return False\n",
|
35
|
-
" \n",
|
36
|
-
" if loc in assign.values():\n",
|
37
|
-
" return False\n",
|
38
|
-
" return True\n",
|
39
|
-
"def backtrack(houses, locs):\n",
|
40
|
-
" assign = {house : -1 for house in houses} \n",
|
41
|
-
" return rec_backtrack(assign, locs)\n",
|
42
|
-
"def rec_backtrack(assign, locs):\n",
|
43
|
-
" if check(assign, -1):\n",
|
44
|
-
" return assign\n",
|
45
|
-
" choices = [x for x in assign if assign[x] == -1]\n",
|
46
|
-
" house = choices[0] if choices else None\n",
|
47
|
-
" for loc in locs:\n",
|
48
|
-
" if check(assign, loc):\n",
|
49
|
-
" assign[house] = loc\n",
|
50
|
-
" res = rec_backtrack(assign, locs)\n",
|
51
|
-
" if res:\n",
|
52
|
-
" return res\n",
|
53
|
-
" assign[house] = -1\n",
|
54
|
-
" return None\n",
|
55
|
-
"def display_house(result):\n",
|
56
|
-
" g = nx.Graph()\n",
|
57
|
-
" nodes = list(result.keys())\n",
|
58
|
-
" nodes.sort(key = lambda x : result[x])\n",
|
59
|
-
" nodes = [f\"{node}({result[node]})\" for node in nodes]\n",
|
60
|
-
" for u, v in zip(nodes, nodes[1:]):\n",
|
61
|
-
" g.add_edge(u, v)\n",
|
62
|
-
" pos = {node : (0, i) for i, node in enumerate(nodes)}\n",
|
63
|
-
" nx.draw(g, pos, with_labels = True,\n",
|
64
|
-
" width = 1.5, edge_color = 'red',\n",
|
65
|
-
" node_size = 800, node_color = 'lightgreen',\n",
|
66
|
-
" font_size = 12, font_family = 'cursive',\n",
|
67
|
-
" edgecolors = 'black', linewidths = 1.5,\n",
|
68
|
-
" margins = 0.2, clip_on = False)\n",
|
69
|
-
" plt.suptitle(\"House Allocation(Constraint Satisfaction Problem)\")\n",
|
70
|
-
" plt.show()\n",
|
71
|
-
" plt.clf()\n",
|
72
|
-
"\n",
|
73
|
-
"def main():\n",
|
74
|
-
" #Info: \"There are 4 family namely A, B, C, D there are 4 houses namely 1,2,3,4\"\n",
|
75
|
-
" #1. C lives in a house higher than D\n",
|
76
|
-
" #2. D lives next to A in Lower number House\n",
|
77
|
-
" #3. There is at least one house between D and B\n",
|
78
|
-
" #4. C doesn't live in house number 3\n",
|
79
|
-
" #5. B doesn't live in house number 1\n",
|
80
|
-
" locs = [1,2,3,4]\n",
|
81
|
-
" houses = ['A','B','C','D']\n",
|
82
|
-
" sol = backtrack(houses, locs)\n",
|
83
|
-
" if sol:\n",
|
84
|
-
" display_house(sol)\n",
|
85
|
-
" for node in sol:\n",
|
86
|
-
" print(\"House:\",node,\" Location:\",sol[node])\n",
|
87
|
-
" else:\n",
|
88
|
-
" print(\"No Solution Exists\")\n",
|
89
|
-
"\n",
|
90
|
-
" #Sample Input/Output\n",
|
91
|
-
" #House: A Location: 2\n",
|
92
|
-
" #House: B Location: 3\n",
|
93
|
-
" #House: C Location: 4\n",
|
94
|
-
" #House: D Location: 1\n",
|
95
|
-
"main()"
|
96
|
-
]
|
97
|
-
}
|
98
|
-
],
|
99
|
-
"metadata": {
|
100
|
-
"kernelspec": {
|
101
|
-
"display_name": "Python 3 (ipykernel)",
|
102
|
-
"language": "python",
|
103
|
-
"name": "python3"
|
104
|
-
},
|
105
|
-
"language_info": {
|
106
|
-
"codemirror_mode": {
|
107
|
-
"name": "ipython",
|
108
|
-
"version": 3
|
109
|
-
},
|
110
|
-
"file_extension": ".py",
|
111
|
-
"mimetype": "text/x-python",
|
112
|
-
"name": "python",
|
113
|
-
"nbconvert_exporter": "python",
|
114
|
-
"pygments_lexer": "ipython3",
|
115
|
-
"version": "3.12.4"
|
116
|
-
}
|
117
|
-
},
|
118
|
-
"nbformat": 4,
|
119
|
-
"nbformat_minor": 5
|
120
|
-
}
|