├── AI for Medicine Specialization in Coursera ├── AI For Medical Treatment │ ├── week 1 │ │ └── Estimating Treatment Effect Using Machine Learning.ipynb │ ├── week 2 │ │ └── Natural Language Entity Extraction.ipynb │ └── week 3 │ │ └── ML Interpretation.ipynb ├── AI for Medical Diagnosis │ ├── week1 │ │ └── Chest X-Ray Medical Diagnosis with Deep Learning.ipynb │ ├── week2 │ │ └── Evaluation of Diagnostic Models.ipynb │ └── week3 │ │ └── Brain Tumor Auto-Segmentation for Magnetic Resonance Imaging (MRI).ipynb ├── AI for Medical Prognosis │ ├── week 1 │ │ └── Build and Evaluate a Linear Risk model.ipynb │ ├── week 2 │ │ └── Risk Models Using Tree-based Models.ipynb │ ├── week 3 │ │ └── Survival Estimates that Varies with Time.ipynb │ └── week 4 │ │ └── Cox Proportional Hazards and Random Survival Forests.ipynb ├── AI for Medicine.jpg └── Readme.md ├── Blockchain Specialization in Coursera ├── Blockchain Basics │ └── submission.txt ├── Decentralized Applications (Dapps) │ ├── Auction.sol │ └── test.js ├── Readme.md └── Smart Contracts │ ├── Auction v1.sol │ └── Auction v2.sol ├── Deep Learning(Andrew Ng) ├── Convolutional Neural Networks │ ├── week1 │ │ ├── Convolution_model_Application_v1a.ipynb │ │ └── Convolution_model_Step_by_Step_v2a (1).ipynb │ ├── week2 │ │ └── Residual_Networks_v2a.ipynb │ ├── week3 │ │ └── Autonomous_driving_application_Car_detection_v3a.ipynb │ └── week4 │ │ ├── Art_Generation_with_Neural_Style_Transfer_v3a.ipynb │ │ ├── Face_Recognition_v3a.ipynb │ │ ├── Input │ │ ├── sn400.jpg │ │ └── xdu400.jpg │ │ └── Output │ │ ├── 0.png │ │ ├── 100.png │ │ ├── 120.png │ │ ├── 140.png │ │ ├── 160.png │ │ ├── 180.png │ │ ├── 20.png │ │ ├── 40.png │ │ ├── 60.png │ │ ├── 80.png │ │ ├── XDU_Impressionism.jpg │ │ ├── XDU_Impressionism2.jpg │ │ └── generated_image.jpg ├── Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization │ ├── Week1 │ │ ├── Gradient+Checking+v1.ipynb │ │ ├── Initialization.ipynb │ │ ├── Readme │ │ └── Regularization_v2a.ipynb │ ├── Week2 │ │ ├── Optimization_methods_v1b.ipynb │ │ └── readme │ └── Week3 │ │ ├── TensorFlow_Tutorial_v3b.ipynb │ │ └── readme ├── Neural Networks and Deep Learning │ ├── Week1 │ │ ├── Logistic_Regression_with_a_Neural_Network_mindset_v6a.ipynb │ │ └── readme │ ├── Week2 │ │ ├── Planar_data_classification_with_onehidden_layer_v6c.ipynb │ │ └── readme │ └── Week3 │ │ ├── Building_your_Deep_Neural_Network_Step_by_Step_v8a.ipynb │ │ ├── Deep+Neural+Network+-+Application+v8.ipynb │ │ └── readme ├── Readme.md └── Sequence Model │ ├── week1 │ ├── Building_a_Recurrent_Neural_Network_Step_by_Step_v3b.ipynb │ ├── jazz │ │ ├── Improvise_a_Jazz_Solo_with_an_LSTM_Network_v3a.ipynb │ │ ├── my_music.midi │ │ ├── training_example.mp3 │ │ └── 输出(部分).mp3 │ └── 恐龙取名 │ │ ├── Dinosaurus_Island_Character_level_language_model_final_v3b.ipynb │ │ ├── iter=0.jpg │ │ ├── iter=34000.jpg │ │ ├── mypoem.png │ │ └── real.jpg │ ├── week2 │ ├── Emojify │ │ ├── Emojify_LSTM.png │ │ ├── Emojify_LSTM_res.png │ │ ├── Emojify_softmax.png │ │ ├── Emojify_softmax_res.png │ │ └── Emojify_v2a.ipynb │ └── Operations on word │ │ ├── Operations+on+word+vectors+-+v2.ipynb │ │ ├── Word vector.png │ │ ├── debias_equalization.png │ │ └── debias_neuralize.png │ └── week3 │ ├── Neural Machine Translation │ ├── NMT.jpg │ └── Neural_machine_translation_with_attention_v4a.ipynb │ └── Trigger_word_detection │ ├── Trigger_word_detection_v1a.ipynb │ ├── architecture.png │ ├── data synthesis.png │ ├── label_diagram.png │ ├── output.png │ ├── prediction1.png │ ├── prediction1.wav │ ├── prediction2.png │ ├── prediction2.wav │ └── spectrogram.png ├── Generative Adversarial Networks (GANs) Specialization in Coursera ├── Apply Generative Adversarial Networks (GANs) │ ├── week1 │ │ └── C3W1_Assignment.ipynb │ ├── week2 │ │ ├── C3W2A_Assignment.ipynb │ │ └── C3W2B_Assignment.ipynb │ └── week3 │ │ └── C3W3_Assignment.ipynb ├── Build Basic Generative Adversarial Networks (GANs) │ ├── week1 │ │ └── C1W1_Your_First_GAN.ipynb │ ├── week2 │ │ └── C1_W2_Assignment.ipynb │ ├── week3 │ │ └── C1W3_WGAN_GP .ipynb │ └── week4 │ │ ├── C1W4A_Build_a_Conditional_GAN.ipynb │ │ └── C1W4B_Controllable_Generation.ipynb ├── Build Better Generative Adversarial Networks (GANs) │ ├── week1 │ │ └── C2W1_Assignment.ipynb │ └── week3 │ │ └── C2W3_Assignment.ipynb ├── GAN.jpg └── Readme.md ├── Machine Learning(Andrew Ng) ├── Readme.md ├── machine-learning-ex1 │ ├── 3-D figure.jpg │ ├── contour figure.jpg │ ├── ex1.pdf │ ├── ex1 │ │ ├── computeCost.m │ │ ├── computeCostMulti.m │ │ ├── ex1.m │ │ ├── ex1_multi.m │ │ ├── ex1data1.txt │ │ ├── ex1data2.txt │ │ ├── featureNormalize.m │ │ ├── gradientDescent.m │ │ ├── gradientDescentMulti.m │ │ ├── lib │ │ │ ├── jsonlab │ │ │ │ ├── AUTHORS.txt │ │ │ │ ├── ChangeLog.txt │ │ │ │ ├── LICENSE_BSD.txt │ │ │ │ ├── README.txt │ │ │ │ ├── jsonopt.m │ │ │ │ ├── loadjson.m │ │ │ │ ├── loadubjson.m │ │ │ │ ├── mergestruct.m │ │ │ │ ├── savejson.m │ │ │ │ ├── saveubjson.m │ │ │ │ └── varargin2struct.m │ │ │ ├── makeValidFieldName.m │ │ │ └── submitWithConfiguration.m │ │ ├── normalEqn.m │ │ ├── plotData.m │ │ ├── submit.m │ │ └── warmUpExercise.m │ └── linear regression.jpg ├── machine-learning-ex2 │ ├── classification.jpg │ ├── classification2.jpg │ ├── machine-learning-ex2 │ │ ├── ex2.pdf │ │ └── ex2 │ │ │ ├── costFunction.m │ │ │ ├── costFunctionReg.m │ │ │ ├── ex2.m │ │ │ ├── ex2_reg.m │ │ │ ├── ex2data1.txt │ │ │ ├── ex2data2.txt │ │ │ ├── lib │ │ │ ├── jsonlab │ │ │ │ ├── AUTHORS.txt │ │ │ │ ├── ChangeLog.txt │ │ │ │ ├── LICENSE_BSD.txt │ │ │ │ ├── README.txt │ │ │ │ ├── jsonopt.m │ │ │ │ ├── loadjson.m │ │ │ │ ├── loadubjson.m │ │ │ │ ├── mergestruct.m │ │ │ │ ├── savejson.m │ │ │ │ ├── saveubjson.m │ │ │ │ └── varargin2struct.m │ │ │ ├── makeValidFieldName.m │ │ │ └── submitWithConfiguration.m │ │ │ ├── mapFeature.m │ │ │ ├── plotData.m │ │ │ ├── plotDecisionBoundary.m │ │ │ ├── predict.m │ │ │ ├── sigmoid.m │ │ │ └── submit.m │ ├── points group.jpg │ └── points group2.jpg ├── machine-learning-ex3 │ ├── digits.jpg │ └── machine-learning-ex3 │ │ ├── ex3.pdf │ │ └── ex3 │ │ ├── AUTHORS.txt │ │ ├── ChangeLog.txt │ │ ├── LICENSE_BSD.txt │ │ ├── README.txt │ │ ├── displayData.m │ │ ├── ex3.m │ │ ├── ex3_nn.m │ │ ├── ex3data1.mat │ │ ├── ex3weights.mat │ │ ├── fmincg.m │ │ ├── jsonopt.m │ │ ├── loadjson.m │ │ ├── loadubjson.m │ │ ├── lrCostFunction.m │ │ ├── makeValidFieldName.m │ │ ├── mergestruct.m │ │ ├── oneVsAll.m │ │ ├── predict.m │ │ ├── predictOneVsAll.m │ │ ├── savejson.m │ │ ├── saveubjson.m │ │ ├── sigmoid.m │ │ ├── submit.m │ │ ├── submitWithConfiguration.m │ │ ├── token.mat │ │ └── varargin2struct.m ├── machine-learning-ex4 │ ├── VisualNN.jpg │ ├── digits.jpg │ └── machine-learning-ex4 │ │ ├── ex4.pdf │ │ └── ex4 │ │ ├── AUTHORS.txt │ │ ├── ChangeLog.txt │ │ ├── LICENSE_BSD.txt │ │ ├── README.txt │ │ ├── checkNNGradients.m │ │ ├── computeNumericalGradient.m │ │ ├── debugInitializeWeights.m │ │ ├── displayData.m │ │ ├── ex4.m │ │ ├── ex4data1.mat │ │ ├── ex4weights.mat │ │ ├── fmincg.m │ │ ├── jsonopt.m │ │ ├── loadjson.m │ │ ├── loadubjson.m │ │ ├── makeValidFieldName.m │ │ ├── mergestruct.m │ │ ├── nnCostFunction.m │ │ ├── predict.m │ │ ├── randInitializeWeights.m │ │ ├── savejson.m │ │ ├── saveubjson.m │ │ ├── sigmoid.m │ │ ├── sigmoidGradient.m │ │ ├── submit.m │ │ ├── submitWithConfiguration.m │ │ ├── token.mat │ │ └── varargin2struct.m ├── machine-learning-ex5 │ └── machine-learning-ex5 │ │ ├── error lambda plot.jpg │ │ ├── ex5.pdf │ │ ├── ex5 │ │ ├── ex5.m │ │ ├── ex5_2.m │ │ ├── ex5data1.mat │ │ ├── featureNormalize.m │ │ ├── fmincg.m │ │ ├── learningCurve.m │ │ ├── lib │ │ │ ├── jsonlab │ │ │ │ ├── AUTHORS.txt │ │ │ │ ├── ChangeLog.txt │ │ │ │ ├── LICENSE_BSD.txt │ │ │ │ ├── README.txt │ │ │ │ ├── jsonopt.m │ │ │ │ ├── loadjson.m │ │ │ │ ├── loadubjson.m │ │ │ │ ├── mergestruct.m │ │ │ │ ├── savejson.m │ │ │ │ ├── saveubjson.m │ │ │ │ └── varargin2struct.m │ │ │ ├── makeValidFieldName.m │ │ │ └── submitWithConfiguration.m │ │ ├── linearRegCostFunction.m │ │ ├── plotFit.m │ │ ├── polyFeatures.m │ │ ├── submit.m │ │ ├── token.mat │ │ ├── trainLinearReg.m │ │ └── validationCurve.m │ │ ├── learning curve1.jpg │ │ ├── learning curve2.jpg │ │ ├── linear fit.jpg │ │ ├── original data.jpg │ │ └── polynomial regression fit.jpg ├── machine-learning-ex6 │ ├── Example Dataset 2.jpg │ ├── Example Dataset 3.jpg │ ├── Example Dataset.jpg │ ├── SVM (Gaussian Kernel) Decision Boundary (Example Dataset 3).jpg │ ├── SVM (Gaussian Kernel) Decision Boundary.jpg │ ├── SVM Decision Boundary with C = 1.jpg │ ├── SVM Decision Boundary with C = 100 (Example Dataset 1).jpg │ ├── emailSample3.jpg │ ├── ex6.pdf │ ├── ex6 │ │ ├── Sample3.txt │ │ ├── dataset3Params.m │ │ ├── emailFeatures.m │ │ ├── emailSample1.txt │ │ ├── emailSample2.txt │ │ ├── ex6.m │ │ ├── ex6_spam.m │ │ ├── ex6data1.mat │ │ ├── ex6data2.mat │ │ ├── ex6data3.mat │ │ ├── gaussianKernel.m │ │ ├── getVocabList.m │ │ ├── lib │ │ │ ├── jsonlab │ │ │ │ ├── AUTHORS.txt │ │ │ │ ├── ChangeLog.txt │ │ │ │ ├── LICENSE_BSD.txt │ │ │ │ ├── README.txt │ │ │ │ ├── jsonopt.m │ │ │ │ ├── loadjson.m │ │ │ │ ├── loadubjson.m │ │ │ │ ├── mergestruct.m │ │ │ │ ├── savejson.m │ │ │ │ ├── saveubjson.m │ │ │ │ └── varargin2struct.m │ │ │ ├── makeValidFieldName.m │ │ │ └── submitWithConfiguration.m │ │ ├── linearKernel.m │ │ ├── plotData.m │ │ ├── porterStemmer.m │ │ ├── processEmail.m │ │ ├── readFile.m │ │ ├── spamSample1.txt │ │ ├── spamSample2.txt │ │ ├── spamTest.mat │ │ ├── spamTrain.mat │ │ ├── submit.m │ │ ├── svmPredict.m │ │ ├── svmTrain.m │ │ ├── token.mat │ │ ├── visualizeBoundary.m │ │ ├── visualizeBoundaryLinear.m │ │ └── vocab.txt │ ├── original email.jpg │ └── spamResult.txt ├── machine-learning-ex7 │ ├── 2D visualization produced using PCA.jpg │ ├── Clustering_image compression.jpg │ ├── Clustering_iter=1.jpg │ ├── Clustering_iter=10.jpg │ ├── Clustering_iter=5.jpg │ ├── Clustering_iter=7.jpg │ ├── Computed eigenvectors of the dataset.jpg │ ├── Faces dataset.jpg │ ├── Original data in 3D.jpg │ ├── Original images of faces and ones reconstructed.jpg │ ├── Principal components on the face dataset.jpg │ ├── The normalized and projected data after PCA.jpg │ ├── dataset for PCA.jpg │ ├── ex7.pdf │ └── ex7 │ │ ├── bird_small.mat │ │ ├── bird_small.png │ │ ├── computeCentroids.m │ │ ├── displayData.m │ │ ├── drawLine.m │ │ ├── ex7.m │ │ ├── ex7_pca.m │ │ ├── ex7data1.mat │ │ ├── ex7data2.mat │ │ ├── ex7faces.mat │ │ ├── featureNormalize.m │ │ ├── findClosestCentroids.m │ │ ├── kMeansInitCentroids.m │ │ ├── lib │ │ ├── jsonlab │ │ │ ├── AUTHORS.txt │ │ │ ├── ChangeLog.txt │ │ │ ├── LICENSE_BSD.txt │ │ │ ├── README.txt │ │ │ ├── jsonopt.m │ │ │ ├── loadjson.m │ │ │ ├── loadubjson.m │ │ │ ├── mergestruct.m │ │ │ ├── savejson.m │ │ │ ├── saveubjson.m │ │ │ └── varargin2struct.m │ │ ├── makeValidFieldName.m │ │ └── submitWithConfiguration.m │ │ ├── pca.m │ │ ├── plotDataPoints.m │ │ ├── plotProgresskMeans.m │ │ ├── projectData.m │ │ ├── recoverData.m │ │ ├── runkMeans.m │ │ ├── submit.m │ │ └── token.mat └── machine-learning-ex8 │ ├── ex8.pdf │ └── ex8 │ ├── Gaussian distribution contours.jpg │ ├── checkCostFunction.m │ ├── classified anomalies.jpg │ ├── cofiCostFunc.m │ ├── computeNumericalGradient.m │ ├── estimateGaussian.m │ ├── ex8.m │ ├── ex8_cofi.m │ ├── ex8_movieParams.mat │ ├── ex8_movies.mat │ ├── ex8data1.mat │ ├── ex8data2.mat │ ├── first dataset.jpg │ ├── fmincg.m │ ├── lib │ ├── jsonlab │ │ ├── AUTHORS.txt │ │ ├── ChangeLog.txt │ │ ├── LICENSE_BSD.txt │ │ ├── README.txt │ │ ├── jsonopt.m │ │ ├── loadjson.m │ │ ├── loadubjson.m │ │ ├── mergestruct.m │ │ ├── savejson.m │ │ ├── saveubjson.m │ │ └── varargin2struct.m │ ├── makeValidFieldName.m │ └── submitWithConfiguration.m │ ├── loadMovieList.m │ ├── movie_ids.txt │ ├── multivariateGaussian.m │ ├── normalizeRatings.m │ ├── recommended system.txt │ ├── selectThreshold.m │ ├── submit.m │ ├── token.mat │ └── visualizeFit.m ├── Natural Language Processing Specialization in Coursera ├── NLP with Attention Model │ ├── week1 │ │ └── C4_W1_Assignment.ipynb │ ├── week2 │ │ └── C4_W2_Assignment.ipynb │ ├── week3 │ │ └── C4_W3_Assignment.ipynb │ └── week4 │ │ └── C4_W4_Assignment.ipynb ├── NLP with Classification and Vector Spaces │ ├── week1 │ │ └── C1_W1_Assignment_Logistic Regression.pdf │ ├── week2 │ │ ├── C1_W2_Assignment.ipynb │ │ ├── C1_W2_Assignment_Naive Bayes.pdf │ │ ├── 实验结果_false.jpg │ │ └── 实验结果_false2.jpg │ ├── week3 │ │ └── C1_W3_Assignment_Word Vectors.pdf │ └── week4 │ │ └── C1_W4_Assignment_Naive Machine Translation and LSH.pdf ├── NLP with Probabilistic Models │ ├── week1 │ │ ├── C2_W1_Assignment.json │ │ └── C2_W1_Assignment_Auto Correct.pdf │ ├── week2 │ │ └── C2_W2_Assignment_Parts-of-Speech Tagging (POS).pdf │ ├── week3 │ │ ├── C2_W3_Assignment_Auto-Complete.ipynb │ │ └── C2_W3_Assignment_Auto-Complete.pdf │ └── week4 │ │ ├── C2_W4_Assignment_Word Embeddings .ipynb │ │ └── C2_W4_Assignment_Word Embeddings.pdf ├── NLP with Sequence Models │ ├── week1 │ │ ├── C3_W1_Assignment_Sentiment with Deep Neural Networks.ipynb │ │ └── C3_W1_Assignment_Sentiment with Deep Neural Networks.pdf │ ├── week2 │ │ ├── C3_W2_Assignment_Deep N-grams.ipynb │ │ └── C3_W2_Assignment_Deep N-grams.pdf │ ├── week3 │ │ ├── C3_W3_Assignment_Named Entity Recognition (NER).ipynb │ │ └── C3_W3_Assignment_Named Entity Recognition (NER).pdf │ └── week4 │ │ ├── C3_W4_Assignment_Question duplicates.ipynb │ │ └── C3_W4_Assignment_Question duplicates.pdf ├── NLP.jpg └── Readme.md └── README.md /AI for Medicine Specialization in Coursera/AI for Medicine.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/AI for Medicine Specialization in Coursera/AI for Medicine.jpg -------------------------------------------------------------------------------- /AI for Medicine Specialization in Coursera/Readme.md: -------------------------------------------------------------------------------- 1 | # Welcome to AI for Medicine Specialization in Coursera 2 | 3 | ## By learning this specialization, I hope you can lay a good foundation. 4 | 5 | ### Here are my certificates: 6 | 7 | #### [AI for Medical Diagnosis](https://coursera.org/share/55a5636e70bcd39a1065ad64d0df3461) 8 | #### [AI for Medical Prognosis](https://coursera.org/share/2db38e551dad3849608564e778934bdf) 9 | #### [AI For Medical Treatment](https://coursera.org/share/d5aae28ff272080899ba9c03dfb48e78) 10 | #### [AI for Medicine Specialization](https://coursera.org/share/5a491a5d05580e0d73386cddc104d2a3) 11 | 12 | ![AI for Medicine](https://github.com/ThreeSR/Coursera/blob/main/AI%20for%20Medicine%20Specialization%20in%20Coursera/AI%20for%20Medicine.jpg?raw=true) 13 | -------------------------------------------------------------------------------- /Blockchain Specialization in Coursera/Blockchain Basics/submission.txt: -------------------------------------------------------------------------------- 1 | 97c8d39fc70b52208f18fc66bbf58874b -------------------------------------------------------------------------------- /Blockchain Specialization in Coursera/Readme.md: -------------------------------------------------------------------------------- 1 | # Welcome to this specialization! 2 | 3 | You can find some files you need to submit when you learn these courses. Apart from these files, you may find it helpful after clicking: https://www.youtube.com/watch?v=pgiiwQvT2BA 4 | 5 | **Notice: You are supposed to manage to accomplish homework by yourself at beginning, then you can check or refer your answers here. I don't recommend you copy answers at first.** 6 | 7 | I hope you can have fun learning in *Coursera*. 8 | 9 | Here are my certificates: 10 | 11 | 12 | [Blockchain Specialization](https://coursera.org/share/3f4952b38d4f9ecc201dc5bc0d74cd7c) 13 | 14 | [Blockchain Basics](https://coursera.org/share/55d0c7ee8414379ebb1e483523f3d899) 15 | 16 | [Blockchain Platforms](https://coursera.org/share/f643eaed2620f66c7d15d2c3a2dd7409) 17 | 18 | [Decentralized Applications (Dapps)](https://coursera.org/share/ab2e13a810159d42f79cd46b9118c327) 19 | 20 | [Smart Contracts](https://coursera.org/share/be3c3f01801ebdd005e65333b45f41dd) 21 | 22 | ![University at Buffalo, the State University of New York](https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/University_at_Buffalo_logo.svg/413px-University_at_Buffalo_logo.svg.png) 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Input/sn400.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Input/sn400.jpg -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Input/xdu400.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Input/xdu400.jpg -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/0.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/100.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/120.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/140.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/140.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/160.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/160.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/180.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/20.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/40.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/60.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/80.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/XDU_Impressionism.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/XDU_Impressionism.jpg -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/XDU_Impressionism2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/XDU_Impressionism2.jpg -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/generated_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Convolutional Neural Networks/week4/Output/generated_image.jpg -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization/Week1/Readme: -------------------------------------------------------------------------------- 1 | Code. 2 | -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization/Week2/readme: -------------------------------------------------------------------------------- 1 | Code. 2 | -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization/Week3/readme: -------------------------------------------------------------------------------- 1 | Code. 2 | -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Neural Networks and Deep Learning/Week1/readme: -------------------------------------------------------------------------------- 1 | Code. 2 | -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Neural Networks and Deep Learning/Week2/readme: -------------------------------------------------------------------------------- 1 | Code. 2 | -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Neural Networks and Deep Learning/Week3/readme: -------------------------------------------------------------------------------- 1 | Code. 2 | -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Readme.md: -------------------------------------------------------------------------------- 1 | # Welcome to Deep Learning Courses in Coursera! 2 | 3 | These are great courses laying a foundation for you to deep learning. If you take them, I hope you can enjoy them. 4 | 5 | Here are my certificates: 6 | 7 | [Neural Networks and Deep Learning](https://coursera.org/share/56f3343846c0e15c514c17faef1fce65) 8 | 9 | [Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization](https://coursera.org/share/a453b6d066006d189e0f6ca3f2c5bfa2) 10 | 11 | [Structuring Machine Learning Projects](https://coursera.org/share/e1b74a47e5411df37e626cffb7dc9f1d) 12 | 13 | [Convolutional Neural Networks](https://coursera.org/share/e7051cbeb5601b7792989ea70ef06832) 14 | 15 | [Sequence Models](https://coursera.org/share/6102887eb20b00e776ebba4ac1dec616) 16 | 17 | [Deep Learning Specialization](https://coursera.org/share/92c07ab949dfb86c3f90bd2d8f4d72b3) 18 | 19 | ![Deep Learning](https://deeplearning-assets.s3.amazonaws.com/content/uploads/2018/09/deeplearning-logo-fb.png) 20 | 21 | -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week1/jazz/my_music.midi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week1/jazz/my_music.midi -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week1/jazz/training_example.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week1/jazz/training_example.mp3 -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week1/jazz/输出(部分).mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week1/jazz/输出(部分).mp3 -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week1/恐龙取名/iter=0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week1/恐龙取名/iter=0.jpg -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week1/恐龙取名/iter=34000.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week1/恐龙取名/iter=34000.jpg -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week1/恐龙取名/mypoem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week1/恐龙取名/mypoem.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week1/恐龙取名/real.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week1/恐龙取名/real.jpg -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week2/Emojify/Emojify_LSTM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week2/Emojify/Emojify_LSTM.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week2/Emojify/Emojify_LSTM_res.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week2/Emojify/Emojify_LSTM_res.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week2/Emojify/Emojify_softmax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week2/Emojify/Emojify_softmax.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week2/Emojify/Emojify_softmax_res.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week2/Emojify/Emojify_softmax_res.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week2/Operations on word/Word vector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week2/Operations on word/Word vector.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week2/Operations on word/debias_equalization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week2/Operations on word/debias_equalization.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week2/Operations on word/debias_neuralize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week2/Operations on word/debias_neuralize.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Neural Machine Translation/NMT.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Neural Machine Translation/NMT.jpg -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/architecture.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/data synthesis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/data synthesis.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/label_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/label_diagram.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/output.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/prediction1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/prediction1.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/prediction1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/prediction1.wav -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/prediction2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/prediction2.png -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/prediction2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/prediction2.wav -------------------------------------------------------------------------------- /Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/spectrogram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Deep Learning(Andrew Ng)/Sequence Model/week3/Trigger_word_detection/spectrogram.png -------------------------------------------------------------------------------- /Generative Adversarial Networks (GANs) Specialization in Coursera/GAN.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Generative Adversarial Networks (GANs) Specialization in Coursera/GAN.jpg -------------------------------------------------------------------------------- /Generative Adversarial Networks (GANs) Specialization in Coursera/Readme.md: -------------------------------------------------------------------------------- 1 | # Welcome to Generative Adversarial Networks (GANs) Specialization in Coursera 2 | 3 | ## By learning this specialization, I hope you can lay a good foundation. 4 | 5 | ### Here are my certificates: 6 | 7 | #### [Build Basic Generative Adversarial Networks (GANs)](https://coursera.org/share/f05266af83a9dc530037f3420a0821c0) 8 | #### [Build Better Generative Adversarial Networks (GANs)](https://www.coursera.org/account/accomplishments/verify/Y2JQRD5CJJMQ?utm_source=link&utm_medium=certificate&utm_content=cert_image&utm_campaign=pdf_header_button&utm_product=course) 9 | #### [Apply Generative Adversarial Networks (GANs)](https://www.coursera.org/account/accomplishments/verify/SXQXWMFDFNTR?utm_source=link&utm_medium=certificate&utm_content=cert_image&utm_campaign=pdf_header_button&utm_product=course) 10 | #### [Generative Adversarial Networks (GANs) Specialization](https://coursera.org/share/094ffb2c049be0f5f11cd8a614918e06) 11 | 12 | ![GAN](https://github.com/ThreeSR/Coursera/blob/main/Generative%20Adversarial%20Networks%20(GANs)%20Specialization%20in%20Coursera/GAN.jpg?raw=true) 13 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/Readme.md: -------------------------------------------------------------------------------- 1 | # Welcome to Machine Learning Course in Coursera! 2 | 3 | ![](https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2136223492,4233252054&fm=26&gp=0.jpg) 4 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/3-D figure.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex1/3-D figure.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/contour figure.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex1/contour figure.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex1/ex1.pdf -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/computeCost.m: -------------------------------------------------------------------------------- 1 | function J = computeCost(X, y, theta) 2 | %COMPUTECOST Compute cost for linear regression 3 | % J = COMPUTECOST(X, y, theta) computes the cost of using theta as the 4 | % parameter for linear regression to fit the data points in X and y 5 | 6 | % Initialize some useful values 7 | m = length(y); % number of training examples 8 | 9 | % You need to return the following variables correctly 10 | J = 0; 11 | 12 | % ====================== YOUR CODE HERE ====================== 13 | % Instructions: Compute the cost of a particular choice of theta 14 | % You should set J to the cost. 15 | 16 | 17 | 18 | 19 | 20 | % ========================================================================= 21 | 22 | end 23 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/computeCostMulti.m: -------------------------------------------------------------------------------- 1 | function J = computeCostMulti(X, y, theta) 2 | %COMPUTECOSTMULTI Compute cost for linear regression with multiple variables 3 | % J = COMPUTECOSTMULTI(X, y, theta) computes the cost of using theta as the 4 | % parameter for linear regression to fit the data points in X and y 5 | 6 | % Initialize some useful values 7 | m = length(y); % number of training examples 8 | 9 | % You need to return the following variables correctly 10 | J = 0; 11 | 12 | % ====================== YOUR CODE HERE ====================== 13 | % Instructions: Compute the cost of a particular choice of theta 14 | % You should set J to the cost. 15 | 16 | 17 | 18 | 19 | 20 | % ========================================================================= 21 | 22 | end 23 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/ex1data1.txt: -------------------------------------------------------------------------------- 1 | 6.1101,17.592 2 | 5.5277,9.1302 3 | 8.5186,13.662 4 | 7.0032,11.854 5 | 5.8598,6.8233 6 | 8.3829,11.886 7 | 7.4764,4.3483 8 | 8.5781,12 9 | 6.4862,6.5987 10 | 5.0546,3.8166 11 | 5.7107,3.2522 12 | 14.164,15.505 13 | 5.734,3.1551 14 | 8.4084,7.2258 15 | 5.6407,0.71618 16 | 5.3794,3.5129 17 | 6.3654,5.3048 18 | 5.1301,0.56077 19 | 6.4296,3.6518 20 | 7.0708,5.3893 21 | 6.1891,3.1386 22 | 20.27,21.767 23 | 5.4901,4.263 24 | 6.3261,5.1875 25 | 5.5649,3.0825 26 | 18.945,22.638 27 | 12.828,13.501 28 | 10.957,7.0467 29 | 13.176,14.692 30 | 22.203,24.147 31 | 5.2524,-1.22 32 | 6.5894,5.9966 33 | 9.2482,12.134 34 | 5.8918,1.8495 35 | 8.2111,6.5426 36 | 7.9334,4.5623 37 | 8.0959,4.1164 38 | 5.6063,3.3928 39 | 12.836,10.117 40 | 6.3534,5.4974 41 | 5.4069,0.55657 42 | 6.8825,3.9115 43 | 11.708,5.3854 44 | 5.7737,2.4406 45 | 7.8247,6.7318 46 | 7.0931,1.0463 47 | 5.0702,5.1337 48 | 5.8014,1.844 49 | 11.7,8.0043 50 | 5.5416,1.0179 51 | 7.5402,6.7504 52 | 5.3077,1.8396 53 | 7.4239,4.2885 54 | 7.6031,4.9981 55 | 6.3328,1.4233 56 | 6.3589,-1.4211 57 | 6.2742,2.4756 58 | 5.6397,4.6042 59 | 9.3102,3.9624 60 | 9.4536,5.4141 61 | 8.8254,5.1694 62 | 5.1793,-0.74279 63 | 21.279,17.929 64 | 14.908,12.054 65 | 18.959,17.054 66 | 7.2182,4.8852 67 | 8.2951,5.7442 68 | 10.236,7.7754 69 | 5.4994,1.0173 70 | 20.341,20.992 71 | 10.136,6.6799 72 | 7.3345,4.0259 73 | 6.0062,1.2784 74 | 7.2259,3.3411 75 | 5.0269,-2.6807 76 | 6.5479,0.29678 77 | 7.5386,3.8845 78 | 5.0365,5.7014 79 | 10.274,6.7526 80 | 5.1077,2.0576 81 | 5.7292,0.47953 82 | 5.1884,0.20421 83 | 6.3557,0.67861 84 | 9.7687,7.5435 85 | 6.5159,5.3436 86 | 8.5172,4.2415 87 | 9.1802,6.7981 88 | 6.002,0.92695 89 | 5.5204,0.152 90 | 5.0594,2.8214 91 | 5.7077,1.8451 92 | 7.6366,4.2959 93 | 5.8707,7.2029 94 | 5.3054,1.9869 95 | 8.2934,0.14454 96 | 13.394,9.0551 97 | 5.4369,0.61705 98 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/ex1data2.txt: -------------------------------------------------------------------------------- 1 | 2104,3,399900 2 | 1600,3,329900 3 | 2400,3,369000 4 | 1416,2,232000 5 | 3000,4,539900 6 | 1985,4,299900 7 | 1534,3,314900 8 | 1427,3,198999 9 | 1380,3,212000 10 | 1494,3,242500 11 | 1940,4,239999 12 | 2000,3,347000 13 | 1890,3,329999 14 | 4478,5,699900 15 | 1268,3,259900 16 | 2300,4,449900 17 | 1320,2,299900 18 | 1236,3,199900 19 | 2609,4,499998 20 | 3031,4,599000 21 | 1767,3,252900 22 | 1888,2,255000 23 | 1604,3,242900 24 | 1962,4,259900 25 | 3890,3,573900 26 | 1100,3,249900 27 | 1458,3,464500 28 | 2526,3,469000 29 | 2200,3,475000 30 | 2637,3,299900 31 | 1839,2,349900 32 | 1000,1,169900 33 | 2040,4,314900 34 | 3137,3,579900 35 | 1811,4,285900 36 | 1437,3,249900 37 | 1239,3,229900 38 | 2132,4,345000 39 | 4215,4,549000 40 | 2162,4,287000 41 | 1664,2,368500 42 | 2238,3,329900 43 | 2567,4,314000 44 | 1200,3,299000 45 | 852,2,179900 46 | 1852,4,299900 47 | 1203,3,239500 48 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/featureNormalize.m: -------------------------------------------------------------------------------- 1 | function [X_norm, mu, sigma] = featureNormalize(X) 2 | %FEATURENORMALIZE Normalizes the features in X 3 | % FEATURENORMALIZE(X) returns a normalized version of X where 4 | % the mean value of each feature is 0 and the standard deviation 5 | % is 1. This is often a good preprocessing step to do when 6 | % working with learning algorithms. 7 | 8 | % You need to set these values correctly 9 | X_norm = X; 10 | mu = zeros(1, size(X, 2)); 11 | sigma = zeros(1, size(X, 2)); 12 | 13 | % ====================== YOUR CODE HERE ====================== 14 | % Instructions: First, for each feature dimension, compute the mean 15 | % of the feature and subtract it from the dataset, 16 | % storing the mean value in mu. Next, compute the 17 | % standard deviation of each feature and divide 18 | % each feature by it's standard deviation, storing 19 | % the standard deviation in sigma. 20 | % 21 | % Note that X is a matrix where each column is a 22 | % feature and each row is an example. You need 23 | % to perform the normalization separately for 24 | % each feature. 25 | % 26 | % Hint: You might find the 'mean' and 'std' functions useful. 27 | % 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | % ============================================================ 38 | 39 | end 40 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/gradientDescent.m: -------------------------------------------------------------------------------- 1 | function [theta, J_history] = gradientDescent(X, y, theta, alpha, num_iters) 2 | %GRADIENTDESCENT Performs gradient descent to learn theta 3 | % theta = GRADIENTDESCENT(X, y, theta, alpha, num_iters) updates theta by 4 | % taking num_iters gradient steps with learning rate alpha 5 | 6 | % Initialize some useful values 7 | m = length(y); % number of training examples 8 | J_history = zeros(num_iters, 1); 9 | 10 | for iter = 1:num_iters 11 | 12 | % ====================== YOUR CODE HERE ====================== 13 | % Instructions: Perform a single gradient step on the parameter vector 14 | % theta. 15 | % 16 | % Hint: While debugging, it can be useful to print out the values 17 | % of the cost function (computeCost) and gradient here. 18 | % 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | % ============================================================ 27 | 28 | % Save the cost J in every iteration 29 | J_history(iter) = computeCost(X, y, theta); 30 | 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/gradientDescentMulti.m: -------------------------------------------------------------------------------- 1 | function [theta, J_history] = gradientDescentMulti(X, y, theta, alpha, num_iters) 2 | %GRADIENTDESCENTMULTI Performs gradient descent to learn theta 3 | % theta = GRADIENTDESCENTMULTI(x, y, theta, alpha, num_iters) updates theta by 4 | % taking num_iters gradient steps with learning rate alpha 5 | 6 | % Initialize some useful values 7 | m = length(y); % number of training examples 8 | J_history = zeros(num_iters, 1); 9 | 10 | for iter = 1:num_iters 11 | 12 | % ====================== YOUR CODE HERE ====================== 13 | % Instructions: Perform a single gradient step on the parameter vector 14 | % theta. 15 | % 16 | % Hint: While debugging, it can be useful to print out the values 17 | % of the cost function (computeCostMulti) and gradient here. 18 | % 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | % ============================================================ 31 | 32 | % Save the cost J in every iteration 33 | J_history(iter) = computeCostMulti(X, y, theta); 34 | 35 | end 36 | 37 | end 38 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/lib/jsonlab/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | The author of "jsonlab" toolbox is Qianqian Fang. Qianqian 2 | is currently an Assistant Professor at Massachusetts General Hospital, 3 | Harvard Medical School. 4 | 5 | Address: Martinos Center for Biomedical Imaging, 6 | Massachusetts General Hospital, 7 | Harvard Medical School 8 | Bldg 149, 13th St, Charlestown, MA 02129, USA 9 | URL: http://nmr.mgh.harvard.edu/~fangq/ 10 | Email: or 11 | 12 | 13 | The script loadjson.m was built upon previous works by 14 | 15 | - Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713 16 | date: 2009/11/02 17 | - François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393 18 | date: 2009/03/22 19 | - Joel Feenstra: http://www.mathworks.com/matlabcentral/fileexchange/20565 20 | date: 2008/07/03 21 | 22 | 23 | This toolbox contains patches submitted by the following contributors: 24 | 25 | - Blake Johnson 26 | part of revision 341 27 | 28 | - Niclas Borlin 29 | various fixes in revision 394, including 30 | - loadjson crashes for all-zero sparse matrix. 31 | - loadjson crashes for empty sparse matrix. 32 | - Non-zero size of 0-by-N and N-by-0 empty matrices is lost after savejson/loadjson. 33 | - loadjson crashes for sparse real column vector. 34 | - loadjson crashes for sparse complex column vector. 35 | - Data is corrupted by savejson for sparse real row vector. 36 | - savejson crashes for sparse complex row vector. 37 | 38 | - Yul Kang 39 | patches for svn revision 415. 40 | - savejson saves an empty cell array as [] instead of null 41 | - loadjson differentiates an empty struct from an empty array 42 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/lib/jsonlab/LICENSE_BSD.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011-2015 Qianqian Fang . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are 4 | permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of 7 | conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 10 | of conditions and the following disclaimer in the documentation and/or other materials 11 | provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY EXPRESS OR IMPLIED 14 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 16 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 21 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | The views and conclusions contained in the software and documentation are those of the 24 | authors and should not be interpreted as representing official policies, either expressed 25 | or implied, of the copyright holders. 26 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/lib/jsonlab/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/lib/jsonlab/README.txt -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/lib/jsonlab/jsonopt.m: -------------------------------------------------------------------------------- 1 | function val=jsonopt(key,default,varargin) 2 | % 3 | % val=jsonopt(key,default,optstruct) 4 | % 5 | % setting options based on a struct. The struct can be produced 6 | % by varargin2struct from a list of 'param','value' pairs 7 | % 8 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 9 | % 10 | % $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $ 11 | % 12 | % input: 13 | % key: a string with which one look up a value from a struct 14 | % default: if the key does not exist, return default 15 | % optstruct: a struct where each sub-field is a key 16 | % 17 | % output: 18 | % val: if key exists, val=optstruct.key; otherwise val=default 19 | % 20 | % license: 21 | % BSD, see LICENSE_BSD.txt files for details 22 | % 23 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 24 | % 25 | 26 | val=default; 27 | if(nargin<=2) return; end 28 | opt=varargin{1}; 29 | if(isstruct(opt) && isfield(opt,key)) 30 | val=getfield(opt,key); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/lib/jsonlab/mergestruct.m: -------------------------------------------------------------------------------- 1 | function s=mergestruct(s1,s2) 2 | % 3 | % s=mergestruct(s1,s2) 4 | % 5 | % merge two struct objects into one 6 | % 7 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 8 | % date: 2012/12/22 9 | % 10 | % input: 11 | % s1,s2: a struct object, s1 and s2 can not be arrays 12 | % 13 | % output: 14 | % s: the merged struct object. fields in s1 and s2 will be combined in s. 15 | % 16 | % license: 17 | % BSD, see LICENSE_BSD.txt files for details 18 | % 19 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 20 | % 21 | 22 | if(~isstruct(s1) || ~isstruct(s2)) 23 | error('input parameters contain non-struct'); 24 | end 25 | if(length(s1)>1 || length(s2)>1) 26 | error('can not merge struct arrays'); 27 | end 28 | fn=fieldnames(s2); 29 | s=s1; 30 | for i=1:length(fn) 31 | s=setfield(s,fn{i},getfield(s2,fn{i})); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex1/ex1/lib/jsonlab/varargin2struct.m: -------------------------------------------------------------------------------- 1 | function opt=varargin2struct(varargin) 2 | % 3 | % opt=varargin2struct('param1',value1,'param2',value2,...) 4 | % or 5 | % opt=varargin2struct(...,optstruct,...) 6 | % 7 | % convert a series of input parameters into a structure 8 | % 9 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 10 | % date: 2012/12/22 11 | % 12 | % input: 13 | % 'param', value: the input parameters should be pairs of a string and a value 14 | % optstruct: if a parameter is a struct, the fields will be merged to the output struct 15 | % 16 | % output: 17 | % opt: a struct where opt.param1=value1, opt.param2=value2 ... 18 | % 19 | % license: 20 | % BSD, see LICENSE_BSD.txt files for details 21 | % 22 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 23 | % 24 | 25 | len=length(varargin); 26 | opt=struct; 27 | if(len==0) return; end 28 | i=1; 29 | while(i<=len) 30 | if(isstruct(varargin{i})) 31 | opt=mergestruct(opt,varargin{i}); 32 | elseif(ischar(varargin{i}) && i or 11 | 12 | 13 | The script loadjson.m was built upon previous works by 14 | 15 | - Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713 16 | date: 2009/11/02 17 | - François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393 18 | date: 2009/03/22 19 | - Joel Feenstra: http://www.mathworks.com/matlabcentral/fileexchange/20565 20 | date: 2008/07/03 21 | 22 | 23 | This toolbox contains patches submitted by the following contributors: 24 | 25 | - Blake Johnson 26 | part of revision 341 27 | 28 | - Niclas Borlin 29 | various fixes in revision 394, including 30 | - loadjson crashes for all-zero sparse matrix. 31 | - loadjson crashes for empty sparse matrix. 32 | - Non-zero size of 0-by-N and N-by-0 empty matrices is lost after savejson/loadjson. 33 | - loadjson crashes for sparse real column vector. 34 | - loadjson crashes for sparse complex column vector. 35 | - Data is corrupted by savejson for sparse real row vector. 36 | - savejson crashes for sparse complex row vector. 37 | 38 | - Yul Kang 39 | patches for svn revision 415. 40 | - savejson saves an empty cell array as [] instead of null 41 | - loadjson differentiates an empty struct from an empty array 42 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/machine-learning-ex2/ex2/lib/jsonlab/LICENSE_BSD.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011-2015 Qianqian Fang . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are 4 | permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of 7 | conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 10 | of conditions and the following disclaimer in the documentation and/or other materials 11 | provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY EXPRESS OR IMPLIED 14 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 16 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 21 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | The views and conclusions contained in the software and documentation are those of the 24 | authors and should not be interpreted as representing official policies, either expressed 25 | or implied, of the copyright holders. 26 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/machine-learning-ex2/ex2/lib/jsonlab/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex2/machine-learning-ex2/ex2/lib/jsonlab/README.txt -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/machine-learning-ex2/ex2/lib/jsonlab/jsonopt.m: -------------------------------------------------------------------------------- 1 | function val=jsonopt(key,default,varargin) 2 | % 3 | % val=jsonopt(key,default,optstruct) 4 | % 5 | % setting options based on a struct. The struct can be produced 6 | % by varargin2struct from a list of 'param','value' pairs 7 | % 8 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 9 | % 10 | % $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $ 11 | % 12 | % input: 13 | % key: a string with which one look up a value from a struct 14 | % default: if the key does not exist, return default 15 | % optstruct: a struct where each sub-field is a key 16 | % 17 | % output: 18 | % val: if key exists, val=optstruct.key; otherwise val=default 19 | % 20 | % license: 21 | % BSD, see LICENSE_BSD.txt files for details 22 | % 23 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 24 | % 25 | 26 | val=default; 27 | if(nargin<=2) return; end 28 | opt=varargin{1}; 29 | if(isstruct(opt) && isfield(opt,key)) 30 | val=getfield(opt,key); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/machine-learning-ex2/ex2/lib/jsonlab/mergestruct.m: -------------------------------------------------------------------------------- 1 | function s=mergestruct(s1,s2) 2 | % 3 | % s=mergestruct(s1,s2) 4 | % 5 | % merge two struct objects into one 6 | % 7 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 8 | % date: 2012/12/22 9 | % 10 | % input: 11 | % s1,s2: a struct object, s1 and s2 can not be arrays 12 | % 13 | % output: 14 | % s: the merged struct object. fields in s1 and s2 will be combined in s. 15 | % 16 | % license: 17 | % BSD, see LICENSE_BSD.txt files for details 18 | % 19 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 20 | % 21 | 22 | if(~isstruct(s1) || ~isstruct(s2)) 23 | error('input parameters contain non-struct'); 24 | end 25 | if(length(s1)>1 || length(s2)>1) 26 | error('can not merge struct arrays'); 27 | end 28 | fn=fieldnames(s2); 29 | s=s1; 30 | for i=1:length(fn) 31 | s=setfield(s,fn{i},getfield(s2,fn{i})); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/machine-learning-ex2/ex2/lib/jsonlab/varargin2struct.m: -------------------------------------------------------------------------------- 1 | function opt=varargin2struct(varargin) 2 | % 3 | % opt=varargin2struct('param1',value1,'param2',value2,...) 4 | % or 5 | % opt=varargin2struct(...,optstruct,...) 6 | % 7 | % convert a series of input parameters into a structure 8 | % 9 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 10 | % date: 2012/12/22 11 | % 12 | % input: 13 | % 'param', value: the input parameters should be pairs of a string and a value 14 | % optstruct: if a parameter is a struct, the fields will be merged to the output struct 15 | % 16 | % output: 17 | % opt: a struct where opt.param1=value1, opt.param2=value2 ... 18 | % 19 | % license: 20 | % BSD, see LICENSE_BSD.txt files for details 21 | % 22 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 23 | % 24 | 25 | len=length(varargin); 26 | opt=struct; 27 | if(len==0) return; end 28 | i=1; 29 | while(i<=len) 30 | if(isstruct(varargin{i})) 31 | opt=mergestruct(opt,varargin{i}); 32 | elseif(ischar(varargin{i}) && i3 matrix, where the first column is all-ones 10 | 11 | % Plot Data 12 | plotData(X(:,2:3), y); 13 | hold on 14 | 15 | if size(X, 2) <= 3 16 | % Only need 2 points to define a line, so choose two endpoints 17 | plot_x = [min(X(:,2))-2, max(X(:,2))+2]; 18 | 19 | % Calculate the decision boundary line 20 | plot_y = (-1./theta(3)).*(theta(2).*plot_x + theta(1)); 21 | 22 | % Plot, and adjust axes for better viewing 23 | plot(plot_x, plot_y) 24 | 25 | % Legend, specific for the exercise 26 | legend('Admitted', 'Not admitted', 'Decision Boundary') 27 | axis([30, 100, 30, 100]) 28 | else 29 | % Here is the grid range 30 | u = linspace(-1, 1.5, 50); 31 | v = linspace(-1, 1.5, 50); 32 | 33 | z = zeros(length(u), length(v)); 34 | % Evaluate z = theta*x over the grid 35 | for i = 1:length(u) 36 | for j = 1:length(v) 37 | z(i,j) = mapFeature(u(i), v(j))*theta; 38 | end 39 | end 40 | z = z'; % important to transpose z before calling contour 41 | 42 | % Plot z = 0 43 | % Notice you need to specify the range [0, 0] 44 | contour(u, v, z, [0, 0], 'LineWidth', 2) 45 | end 46 | hold off 47 | 48 | end 49 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/machine-learning-ex2/ex2/predict.m: -------------------------------------------------------------------------------- 1 | function p = predict(theta, X) 2 | %PREDICT Predict whether the label is 0 or 1 using learned logistic 3 | %regression parameters theta 4 | % p = PREDICT(theta, X) computes the predictions for X using a 5 | % threshold at 0.5 (i.e., if sigmoid(theta'*x) >= 0.5, predict 1) 6 | 7 | m = size(X, 1); % Number of training examples 8 | 9 | % You need to return the following variables correctly 10 | p = zeros(m, 1); 11 | 12 | % ====================== YOUR CODE HERE ====================== 13 | % Instructions: Complete the following code to make predictions using 14 | % your learned logistic regression parameters. 15 | % You should set p to a vector of 0's and 1's 16 | % 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | % ========================================================================= 25 | 26 | 27 | end 28 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/machine-learning-ex2/ex2/sigmoid.m: -------------------------------------------------------------------------------- 1 | function g = sigmoid(z) 2 | %SIGMOID Compute sigmoid function 3 | % g = SIGMOID(z) computes the sigmoid of z. 4 | 5 | % You need to return the following variables correctly 6 | g = zeros(size(z)); 7 | 8 | % ====================== YOUR CODE HERE ====================== 9 | % Instructions: Compute the sigmoid of each value of z (z can be a matrix, 10 | % vector or scalar). 11 | 12 | 13 | 14 | 15 | 16 | % ============================================================= 17 | 18 | end 19 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/machine-learning-ex2/ex2/submit.m: -------------------------------------------------------------------------------- 1 | function submit() 2 | addpath('./lib'); 3 | 4 | conf.assignmentSlug = 'logistic-regression'; 5 | conf.itemName = 'Logistic Regression'; 6 | conf.partArrays = { ... 7 | { ... 8 | '1', ... 9 | { 'sigmoid.m' }, ... 10 | 'Sigmoid Function', ... 11 | }, ... 12 | { ... 13 | '2', ... 14 | { 'costFunction.m' }, ... 15 | 'Logistic Regression Cost', ... 16 | }, ... 17 | { ... 18 | '3', ... 19 | { 'costFunction.m' }, ... 20 | 'Logistic Regression Gradient', ... 21 | }, ... 22 | { ... 23 | '4', ... 24 | { 'predict.m' }, ... 25 | 'Predict', ... 26 | }, ... 27 | { ... 28 | '5', ... 29 | { 'costFunctionReg.m' }, ... 30 | 'Regularized Logistic Regression Cost', ... 31 | }, ... 32 | { ... 33 | '6', ... 34 | { 'costFunctionReg.m' }, ... 35 | 'Regularized Logistic Regression Gradient', ... 36 | }, ... 37 | }; 38 | conf.output = @output; 39 | 40 | submitWithConfiguration(conf); 41 | end 42 | 43 | function out = output(partId, auxstring) 44 | % Random Test Cases 45 | X = [ones(20,1) (exp(1) * sin(1:1:20))' (exp(0.5) * cos(1:1:20))']; 46 | y = sin(X(:,1) + X(:,2)) > 0; 47 | if partId == '1' 48 | out = sprintf('%0.5f ', sigmoid(X)); 49 | elseif partId == '2' 50 | out = sprintf('%0.5f ', costFunction([0.25 0.5 -0.5]', X, y)); 51 | elseif partId == '3' 52 | [cost, grad] = costFunction([0.25 0.5 -0.5]', X, y); 53 | out = sprintf('%0.5f ', grad); 54 | elseif partId == '4' 55 | out = sprintf('%0.5f ', predict([0.25 0.5 -0.5]', X)); 56 | elseif partId == '5' 57 | out = sprintf('%0.5f ', costFunctionReg([0.25 0.5 -0.5]', X, y, 0.1)); 58 | elseif partId == '6' 59 | [cost, grad] = costFunctionReg([0.25 0.5 -0.5]', X, y, 0.1); 60 | out = sprintf('%0.5f ', grad); 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/points group.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex2/points group.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex2/points group2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex2/points group2.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/digits.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex3/digits.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3.pdf -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | The author of "jsonlab" toolbox is Qianqian Fang. Qianqian 2 | is currently an Assistant Professor at Massachusetts General Hospital, 3 | Harvard Medical School. 4 | 5 | Address: Martinos Center for Biomedical Imaging, 6 | Massachusetts General Hospital, 7 | Harvard Medical School 8 | Bldg 149, 13th St, Charlestown, MA 02129, USA 9 | URL: http://nmr.mgh.harvard.edu/~fangq/ 10 | Email: or 11 | 12 | 13 | The script loadjson.m was built upon previous works by 14 | 15 | - Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713 16 | date: 2009/11/02 17 | - François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393 18 | date: 2009/03/22 19 | - Joel Feenstra: http://www.mathworks.com/matlabcentral/fileexchange/20565 20 | date: 2008/07/03 21 | 22 | 23 | This toolbox contains patches submitted by the following contributors: 24 | 25 | - Blake Johnson 26 | part of revision 341 27 | 28 | - Niclas Borlin 29 | various fixes in revision 394, including 30 | - loadjson crashes for all-zero sparse matrix. 31 | - loadjson crashes for empty sparse matrix. 32 | - Non-zero size of 0-by-N and N-by-0 empty matrices is lost after savejson/loadjson. 33 | - loadjson crashes for sparse real column vector. 34 | - loadjson crashes for sparse complex column vector. 35 | - Data is corrupted by savejson for sparse real row vector. 36 | - savejson crashes for sparse complex row vector. 37 | 38 | - Yul Kang 39 | patches for svn revision 415. 40 | - savejson saves an empty cell array as [] instead of null 41 | - loadjson differentiates an empty struct from an empty array 42 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/LICENSE_BSD.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011-2015 Qianqian Fang . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are 4 | permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of 7 | conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 10 | of conditions and the following disclaimer in the documentation and/or other materials 11 | provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY EXPRESS OR IMPLIED 14 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 16 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 21 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | The views and conclusions contained in the software and documentation are those of the 24 | authors and should not be interpreted as representing official policies, either expressed 25 | or implied, of the copyright holders. 26 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/README.txt -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/displayData.m: -------------------------------------------------------------------------------- 1 | function [h, display_array] = displayData(X, example_width) 2 | %DISPLAYDATA Display 2D data in a nice grid 3 | % [h, display_array] = DISPLAYDATA(X, example_width) displays 2D data 4 | % stored in X in a nice grid. It returns the figure handle h and the 5 | % displayed array if requested. 6 | 7 | % Set example_width automatically if not passed in 8 | if ~exist('example_width', 'var') || isempty(example_width) 9 | example_width = round(sqrt(size(X, 2))); 10 | end 11 | 12 | % Gray Image 13 | colormap(gray); 14 | 15 | % Compute rows, cols 16 | [m n] = size(X); 17 | example_height = (n / example_width); 18 | 19 | % Compute number of items to display 20 | display_rows = floor(sqrt(m)); 21 | display_cols = ceil(m / display_rows); 22 | 23 | % Between images padding 24 | pad = 1; 25 | 26 | % Setup blank display 27 | display_array = - ones(pad + display_rows * (example_height + pad), ... 28 | pad + display_cols * (example_width + pad)); 29 | 30 | % Copy each example into a patch on the display array 31 | curr_ex = 1; 32 | for j = 1:display_rows 33 | for i = 1:display_cols 34 | if curr_ex > m, 35 | break; 36 | end 37 | % Copy the patch 38 | 39 | % Get the max value of the patch 40 | max_val = max(abs(X(curr_ex, :))); 41 | display_array(pad + (j - 1) * (example_height + pad) + (1:example_height), ... 42 | pad + (i - 1) * (example_width + pad) + (1:example_width)) = ... 43 | reshape(X(curr_ex, :), example_height, example_width) / max_val; 44 | curr_ex = curr_ex + 1; 45 | end 46 | if curr_ex > m, 47 | break; 48 | end 49 | end 50 | 51 | % Display Image 52 | h = imagesc(display_array, [-1 1]); 53 | 54 | % Do not show axis 55 | axis image off 56 | 57 | drawnow; 58 | 59 | end 60 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/ex3data1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/ex3data1.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/ex3weights.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/ex3weights.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/jsonopt.m: -------------------------------------------------------------------------------- 1 | function val=jsonopt(key,default,varargin) 2 | % 3 | % val=jsonopt(key,default,optstruct) 4 | % 5 | % setting options based on a struct. The struct can be produced 6 | % by varargin2struct from a list of 'param','value' pairs 7 | % 8 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 9 | % 10 | % $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $ 11 | % 12 | % input: 13 | % key: a string with which one look up a value from a struct 14 | % default: if the key does not exist, return default 15 | % optstruct: a struct where each sub-field is a key 16 | % 17 | % output: 18 | % val: if key exists, val=optstruct.key; otherwise val=default 19 | % 20 | % license: 21 | % BSD, see LICENSE_BSD.txt files for details 22 | % 23 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 24 | % 25 | 26 | val=default; 27 | if(nargin<=2) return; end 28 | opt=varargin{1}; 29 | if(isstruct(opt) && isfield(opt,key)) 30 | val=getfield(opt,key); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/lrCostFunction.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/lrCostFunction.m -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/makeValidFieldName.m: -------------------------------------------------------------------------------- 1 | function str = makeValidFieldName(str) 2 | % From MATLAB doc: field names must begin with a letter, which may be 3 | % followed by any combination of letters, digits, and underscores. 4 | % Invalid characters will be converted to underscores, and the prefix 5 | % "x0x[Hex code]_" will be added if the first character is not a letter. 6 | isoct=exist('OCTAVE_VERSION','builtin'); 7 | pos=regexp(str,'^[^A-Za-z]','once'); 8 | if(~isempty(pos)) 9 | if(~isoct) 10 | str=regexprep(str,'^([^A-Za-z])','x0x${sprintf(''%X'',unicode2native($1))}_','once'); 11 | else 12 | str=sprintf('x0x%X_%s',char(str(1)),str(2:end)); 13 | end 14 | end 15 | if(isempty(regexp(str,'[^0-9A-Za-z_]', 'once' ))) return; end 16 | if(~isoct) 17 | str=regexprep(str,'([^0-9A-Za-z_])','_0x${sprintf(''%X'',unicode2native($1))}_'); 18 | else 19 | pos=regexp(str,'[^0-9A-Za-z_]'); 20 | if(isempty(pos)) return; end 21 | str0=str; 22 | pos0=[0 pos(:)' length(str)]; 23 | str=''; 24 | for i=1:length(pos) 25 | str=[str str0(pos0(i)+1:pos(i)-1) sprintf('_0x%X_',str0(pos(i)))]; 26 | end 27 | if(pos(end)~=length(str)) 28 | str=[str str0(pos0(end-1)+1:pos0(end))]; 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/mergestruct.m: -------------------------------------------------------------------------------- 1 | function s=mergestruct(s1,s2) 2 | % 3 | % s=mergestruct(s1,s2) 4 | % 5 | % merge two struct objects into one 6 | % 7 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 8 | % date: 2012/12/22 9 | % 10 | % input: 11 | % s1,s2: a struct object, s1 and s2 can not be arrays 12 | % 13 | % output: 14 | % s: the merged struct object. fields in s1 and s2 will be combined in s. 15 | % 16 | % license: 17 | % BSD, see LICENSE_BSD.txt files for details 18 | % 19 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 20 | % 21 | 22 | if(~isstruct(s1) || ~isstruct(s2)) 23 | error('input parameters contain non-struct'); 24 | end 25 | if(length(s1)>1 || length(s2)>1) 26 | error('can not merge struct arrays'); 27 | end 28 | fn=fieldnames(s2); 29 | s=s1; 30 | for i=1:length(fn) 31 | s=setfield(s,fn{i},getfield(s2,fn{i})); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/predict.m: -------------------------------------------------------------------------------- 1 | function p = predict(Theta1, Theta2, X) 2 | %PREDICT Predict the label of an input given a trained neural network 3 | % p = PREDICT(Theta1, Theta2, X) outputs the predicted label of X given the 4 | % trained weights of a neural network (Theta1, Theta2) 5 | 6 | % Useful values 7 | m = size(X, 1); 8 | num_labels = size(Theta2, 1); 9 | 10 | % You need to return the following variables correctly 11 | p = zeros(size(X, 1), 1); 12 | 13 | % ====================== YOUR CODE HERE ====================== 14 | % Instructions: Complete the following code to make predictions using 15 | % your learned neural network. You should set p to a 16 | % vector containing labels between 1 to num_labels. 17 | % 18 | % Hint: The max function might come in useful. In particular, the max 19 | % function can also return the index of the max element, for more 20 | % information see 'help max'. If your examples are in rows, then, you 21 | % can use max(A, [], 2) to obtain the max for each row. 22 | % 23 | 24 | a1 = [ones(m, 1) X]; 25 | a2 = sigmoid(a1 * Theta1'); 26 | a2 = [ones(m, 1) a2]; 27 | a3 = sigmoid(a2 * Theta2'); 28 | 29 | [x,p] = max(a3,[],2); 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | % ========================================================================= 38 | 39 | 40 | end 41 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/predictOneVsAll.m: -------------------------------------------------------------------------------- 1 | function p = predictOneVsAll(all_theta, X) 2 | %PREDICT Predict the label for a trained one-vs-all classifier. The labels 3 | %are in the range 1..K, where K = size(all_theta, 1). 4 | % p = PREDICTONEVSALL(all_theta, X) will return a vector of predictions 5 | % for each example in the matrix X. Note that X contains the examples in 6 | % rows. all_theta is a matrix where the i-th row is a trained logistic 7 | % regression theta vector for the i-th class. You should set p to a vector 8 | % of values from 1..K (e.g., p = [1; 3; 1; 2] predicts classes 1, 3, 1, 2 9 | % for 4 examples) 10 | 11 | m = size(X, 1); 12 | num_labels = size(all_theta, 1); 13 | 14 | % You need to return the following variables correctly 15 | p = zeros(size(X, 1), 1); 16 | 17 | % Add ones to the X data matrix 18 | X = [ones(m, 1) X]; 19 | 20 | % ====================== YOUR CODE HERE ====================== 21 | % Instructions: Complete the following code to make predictions using 22 | % your learned logistic regression parameters (one-vs-all). 23 | % You should set p to a vector of predictions (from 1 to 24 | % num_labels). 25 | % 26 | % Hint: This code can be done all vectorized using the max function. 27 | % In particular, the max function can also return the index of the 28 | % max element, for more information see 'help max'. If your examples 29 | % are in rows, then, you can use max(A, [], 2) to obtain the max 30 | % for each row. 31 | % 32 | 33 | temp = X * all_theta'; 34 | [x, p] = max(temp,[],2); 35 | 36 | 37 | 38 | % ========================================================================= 39 | 40 | 41 | end 42 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/sigmoid.m: -------------------------------------------------------------------------------- 1 | function g = sigmoid(z) 2 | %SIGMOID Compute sigmoid functoon 3 | % J = SIGMOID(z) computes the sigmoid of z. 4 | 5 | g = 1.0 ./ (1.0 + exp(-z)); 6 | end 7 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/submit.m: -------------------------------------------------------------------------------- 1 | function submit() 2 | addpath('./lib'); 3 | 4 | conf.assignmentSlug = 'multi-class-classification-and-neural-networks'; 5 | conf.itemName = 'Multi-class Classification and Neural Networks'; 6 | conf.partArrays = { ... 7 | { ... 8 | '1', ... 9 | { 'lrCostFunction.m' }, ... 10 | 'Regularized Logistic Regression', ... 11 | }, ... 12 | { ... 13 | '2', ... 14 | { 'oneVsAll.m' }, ... 15 | 'One-vs-All Classifier Training', ... 16 | }, ... 17 | { ... 18 | '3', ... 19 | { 'predictOneVsAll.m' }, ... 20 | 'One-vs-All Classifier Prediction', ... 21 | }, ... 22 | { ... 23 | '4', ... 24 | { 'predict.m' }, ... 25 | 'Neural Network Prediction Function' ... 26 | }, ... 27 | }; 28 | conf.output = @output; 29 | 30 | submitWithConfiguration(conf); 31 | end 32 | 33 | function out = output(partId, auxdata) 34 | % Random Test Cases 35 | X = [ones(20,1) (exp(1) * sin(1:1:20))' (exp(0.5) * cos(1:1:20))']; 36 | y = sin(X(:,1) + X(:,2)) > 0; 37 | Xm = [ -1 -1 ; -1 -2 ; -2 -1 ; -2 -2 ; ... 38 | 1 1 ; 1 2 ; 2 1 ; 2 2 ; ... 39 | -1 1 ; -1 2 ; -2 1 ; -2 2 ; ... 40 | 1 -1 ; 1 -2 ; -2 -1 ; -2 -2 ]; 41 | ym = [ 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 ]'; 42 | t1 = sin(reshape(1:2:24, 4, 3)); 43 | t2 = cos(reshape(1:2:40, 4, 5)); 44 | 45 | if partId == '1' 46 | [J, grad] = lrCostFunction([0.25 0.5 -0.5]', X, y, 0.1); 47 | out = sprintf('%0.5f ', J); 48 | out = [out sprintf('%0.5f ', grad)]; 49 | elseif partId == '2' 50 | out = sprintf('%0.5f ', oneVsAll(Xm, ym, 4, 0.1)); 51 | elseif partId == '3' 52 | out = sprintf('%0.5f ', predictOneVsAll(t1, Xm)); 53 | elseif partId == '4' 54 | out = sprintf('%0.5f ', predict(t1, t2, Xm)); 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/token.mat: -------------------------------------------------------------------------------- 1 | # Created by Octave 5.2.0, Sat Sep 19 12:20:34 2020 GMT 2 | # name: email 3 | # type: sq_string 4 | # elements: 1 5 | # length: 24 6 | three3.sun.rui@gmail.com 7 | 8 | 9 | # name: token 10 | # type: sq_string 11 | # elements: 1 12 | # length: 16 13 | JbytC3aKW6G4ujfY 14 | 15 | 16 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex3/machine-learning-ex3/ex3/varargin2struct.m: -------------------------------------------------------------------------------- 1 | function opt=varargin2struct(varargin) 2 | % 3 | % opt=varargin2struct('param1',value1,'param2',value2,...) 4 | % or 5 | % opt=varargin2struct(...,optstruct,...) 6 | % 7 | % convert a series of input parameters into a structure 8 | % 9 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 10 | % date: 2012/12/22 11 | % 12 | % input: 13 | % 'param', value: the input parameters should be pairs of a string and a value 14 | % optstruct: if a parameter is a struct, the fields will be merged to the output struct 15 | % 16 | % output: 17 | % opt: a struct where opt.param1=value1, opt.param2=value2 ... 18 | % 19 | % license: 20 | % BSD, see LICENSE_BSD.txt files for details 21 | % 22 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 23 | % 24 | 25 | len=length(varargin); 26 | opt=struct; 27 | if(len==0) return; end 28 | i=1; 29 | while(i<=len) 30 | if(isstruct(varargin{i})) 31 | opt=mergestruct(opt,varargin{i}); 32 | elseif(ischar(varargin{i}) && i or 11 | 12 | 13 | The script loadjson.m was built upon previous works by 14 | 15 | - Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713 16 | date: 2009/11/02 17 | - François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393 18 | date: 2009/03/22 19 | - Joel Feenstra: http://www.mathworks.com/matlabcentral/fileexchange/20565 20 | date: 2008/07/03 21 | 22 | 23 | This toolbox contains patches submitted by the following contributors: 24 | 25 | - Blake Johnson 26 | part of revision 341 27 | 28 | - Niclas Borlin 29 | various fixes in revision 394, including 30 | - loadjson crashes for all-zero sparse matrix. 31 | - loadjson crashes for empty sparse matrix. 32 | - Non-zero size of 0-by-N and N-by-0 empty matrices is lost after savejson/loadjson. 33 | - loadjson crashes for sparse real column vector. 34 | - loadjson crashes for sparse complex column vector. 35 | - Data is corrupted by savejson for sparse real row vector. 36 | - savejson crashes for sparse complex row vector. 37 | 38 | - Yul Kang 39 | patches for svn revision 415. 40 | - savejson saves an empty cell array as [] instead of null 41 | - loadjson differentiates an empty struct from an empty array 42 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/LICENSE_BSD.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011-2015 Qianqian Fang . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are 4 | permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of 7 | conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 10 | of conditions and the following disclaimer in the documentation and/or other materials 11 | provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY EXPRESS OR IMPLIED 14 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 16 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 21 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | The views and conclusions contained in the software and documentation are those of the 24 | authors and should not be interpreted as representing official policies, either expressed 25 | or implied, of the copyright holders. 26 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/README.txt -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/checkNNGradients.m: -------------------------------------------------------------------------------- 1 | function checkNNGradients(lambda) 2 | %CHECKNNGRADIENTS Creates a small neural network to check the 3 | %backpropagation gradients 4 | % CHECKNNGRADIENTS(lambda) Creates a small neural network to check the 5 | % backpropagation gradients, it will output the analytical gradients 6 | % produced by your backprop code and the numerical gradients (computed 7 | % using computeNumericalGradient). These two gradient computations should 8 | % result in very similar values. 9 | % 10 | 11 | if ~exist('lambda', 'var') || isempty(lambda) 12 | lambda = 0; 13 | end 14 | 15 | input_layer_size = 3; 16 | hidden_layer_size = 5; 17 | num_labels = 3; 18 | m = 5; 19 | 20 | % We generate some 'random' test data 21 | Theta1 = debugInitializeWeights(hidden_layer_size, input_layer_size); 22 | Theta2 = debugInitializeWeights(num_labels, hidden_layer_size); 23 | % Reusing debugInitializeWeights to generate X 24 | X = debugInitializeWeights(m, input_layer_size - 1); 25 | y = 1 + mod(1:m, num_labels)'; 26 | 27 | % Unroll parameters 28 | nn_params = [Theta1(:) ; Theta2(:)]; 29 | 30 | % Short hand for cost function 31 | costFunc = @(p) nnCostFunction(p, input_layer_size, hidden_layer_size, ... 32 | num_labels, X, y, lambda); 33 | 34 | [cost, grad] = costFunc(nn_params); 35 | numgrad = computeNumericalGradient(costFunc, nn_params); 36 | 37 | % Visually examine the two gradient computations. The two columns 38 | % you get should be very similar. 39 | disp([numgrad grad]); 40 | fprintf(['The above two columns you get should be very similar.\n' ... 41 | '(Left-Your Numerical Gradient, Right-Analytical Gradient)\n\n']); 42 | 43 | % Evaluate the norm of the difference between two solutions. 44 | % If you have a correct implementation, and assuming you used EPSILON = 0.0001 45 | % in computeNumericalGradient.m, then diff below should be less than 1e-9 46 | diff = norm(numgrad-grad)/norm(numgrad+grad); 47 | 48 | fprintf(['If your backpropagation implementation is correct, then \n' ... 49 | 'the relative difference will be small (less than 1e-9). \n' ... 50 | '\nRelative Difference: %g\n'], diff); 51 | 52 | end 53 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/computeNumericalGradient.m: -------------------------------------------------------------------------------- 1 | function numgrad = computeNumericalGradient(J, theta) 2 | %COMPUTENUMERICALGRADIENT Computes the gradient using "finite differences" 3 | %and gives us a numerical estimate of the gradient. 4 | % numgrad = COMPUTENUMERICALGRADIENT(J, theta) computes the numerical 5 | % gradient of the function J around theta. Calling y = J(theta) should 6 | % return the function value at theta. 7 | 8 | % Notes: The following code implements numerical gradient checking, and 9 | % returns the numerical gradient.It sets numgrad(i) to (a numerical 10 | % approximation of) the partial derivative of J with respect to the 11 | % i-th input argument, evaluated at theta. (i.e., numgrad(i) should 12 | % be the (approximately) the partial derivative of J with respect 13 | % to theta(i).) 14 | % 15 | 16 | numgrad = zeros(size(theta)); 17 | perturb = zeros(size(theta)); 18 | e = 1e-4; 19 | for p = 1:numel(theta) 20 | % Set perturbation vector 21 | perturb(p) = e; 22 | loss1 = J(theta - perturb); 23 | loss2 = J(theta + perturb); 24 | % Compute Numerical Gradient 25 | numgrad(p) = (loss2 - loss1) / (2*e); 26 | perturb(p) = 0; 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/debugInitializeWeights.m: -------------------------------------------------------------------------------- 1 | function W = debugInitializeWeights(fan_out, fan_in) 2 | %DEBUGINITIALIZEWEIGHTS Initialize the weights of a layer with fan_in 3 | %incoming connections and fan_out outgoing connections using a fixed 4 | %strategy, this will help you later in debugging 5 | % W = DEBUGINITIALIZEWEIGHTS(fan_in, fan_out) initializes the weights 6 | % of a layer with fan_in incoming connections and fan_out outgoing 7 | % connections using a fix set of values 8 | % 9 | % Note that W should be set to a matrix of size(1 + fan_in, fan_out) as 10 | % the first row of W handles the "bias" terms 11 | % 12 | 13 | % Set W to zeros 14 | W = zeros(fan_out, 1 + fan_in); 15 | 16 | % Initialize W using "sin", this ensures that W is always of the same 17 | % values and will be useful for debugging 18 | W = reshape(sin(1:numel(W)), size(W)) / 10; 19 | 20 | % ========================================================================= 21 | 22 | end 23 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/displayData.m: -------------------------------------------------------------------------------- 1 | function [h, display_array] = displayData(X, example_width) 2 | %DISPLAYDATA Display 2D data in a nice grid 3 | % [h, display_array] = DISPLAYDATA(X, example_width) displays 2D data 4 | % stored in X in a nice grid. It returns the figure handle h and the 5 | % displayed array if requested. 6 | 7 | % Set example_width automatically if not passed in 8 | if ~exist('example_width', 'var') || isempty(example_width) 9 | example_width = round(sqrt(size(X, 2))); 10 | end 11 | 12 | % Gray Image 13 | colormap(gray); 14 | 15 | % Compute rows, cols 16 | [m n] = size(X); 17 | example_height = (n / example_width); 18 | 19 | % Compute number of items to display 20 | display_rows = floor(sqrt(m)); 21 | display_cols = ceil(m / display_rows); 22 | 23 | % Between images padding 24 | pad = 1; 25 | 26 | % Setup blank display 27 | display_array = - ones(pad + display_rows * (example_height + pad), ... 28 | pad + display_cols * (example_width + pad)); 29 | 30 | % Copy each example into a patch on the display array 31 | curr_ex = 1; 32 | for j = 1:display_rows 33 | for i = 1:display_cols 34 | if curr_ex > m, 35 | break; 36 | end 37 | % Copy the patch 38 | 39 | % Get the max value of the patch 40 | max_val = max(abs(X(curr_ex, :))); 41 | display_array(pad + (j - 1) * (example_height + pad) + (1:example_height), ... 42 | pad + (i - 1) * (example_width + pad) + (1:example_width)) = ... 43 | reshape(X(curr_ex, :), example_height, example_width) / max_val; 44 | curr_ex = curr_ex + 1; 45 | end 46 | if curr_ex > m, 47 | break; 48 | end 49 | end 50 | 51 | % Display Image 52 | h = imagesc(display_array, [-1 1]); 53 | 54 | % Do not show axis 55 | axis image off 56 | 57 | drawnow; 58 | 59 | end 60 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/ex4data1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/ex4data1.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/ex4weights.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/ex4weights.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/jsonopt.m: -------------------------------------------------------------------------------- 1 | function val=jsonopt(key,default,varargin) 2 | % 3 | % val=jsonopt(key,default,optstruct) 4 | % 5 | % setting options based on a struct. The struct can be produced 6 | % by varargin2struct from a list of 'param','value' pairs 7 | % 8 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 9 | % 10 | % $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $ 11 | % 12 | % input: 13 | % key: a string with which one look up a value from a struct 14 | % default: if the key does not exist, return default 15 | % optstruct: a struct where each sub-field is a key 16 | % 17 | % output: 18 | % val: if key exists, val=optstruct.key; otherwise val=default 19 | % 20 | % license: 21 | % BSD, see LICENSE_BSD.txt files for details 22 | % 23 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 24 | % 25 | 26 | val=default; 27 | if(nargin<=2) return; end 28 | opt=varargin{1}; 29 | if(isstruct(opt) && isfield(opt,key)) 30 | val=getfield(opt,key); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/makeValidFieldName.m: -------------------------------------------------------------------------------- 1 | function str = makeValidFieldName(str) 2 | % From MATLAB doc: field names must begin with a letter, which may be 3 | % followed by any combination of letters, digits, and underscores. 4 | % Invalid characters will be converted to underscores, and the prefix 5 | % "x0x[Hex code]_" will be added if the first character is not a letter. 6 | isoct=exist('OCTAVE_VERSION','builtin'); 7 | pos=regexp(str,'^[^A-Za-z]','once'); 8 | if(~isempty(pos)) 9 | if(~isoct) 10 | str=regexprep(str,'^([^A-Za-z])','x0x${sprintf(''%X'',unicode2native($1))}_','once'); 11 | else 12 | str=sprintf('x0x%X_%s',char(str(1)),str(2:end)); 13 | end 14 | end 15 | if(isempty(regexp(str,'[^0-9A-Za-z_]', 'once' ))) return; end 16 | if(~isoct) 17 | str=regexprep(str,'([^0-9A-Za-z_])','_0x${sprintf(''%X'',unicode2native($1))}_'); 18 | else 19 | pos=regexp(str,'[^0-9A-Za-z_]'); 20 | if(isempty(pos)) return; end 21 | str0=str; 22 | pos0=[0 pos(:)' length(str)]; 23 | str=''; 24 | for i=1:length(pos) 25 | str=[str str0(pos0(i)+1:pos(i)-1) sprintf('_0x%X_',str0(pos(i)))]; 26 | end 27 | if(pos(end)~=length(str)) 28 | str=[str str0(pos0(end-1)+1:pos0(end))]; 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/mergestruct.m: -------------------------------------------------------------------------------- 1 | function s=mergestruct(s1,s2) 2 | % 3 | % s=mergestruct(s1,s2) 4 | % 5 | % merge two struct objects into one 6 | % 7 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 8 | % date: 2012/12/22 9 | % 10 | % input: 11 | % s1,s2: a struct object, s1 and s2 can not be arrays 12 | % 13 | % output: 14 | % s: the merged struct object. fields in s1 and s2 will be combined in s. 15 | % 16 | % license: 17 | % BSD, see LICENSE_BSD.txt files for details 18 | % 19 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 20 | % 21 | 22 | if(~isstruct(s1) || ~isstruct(s2)) 23 | error('input parameters contain non-struct'); 24 | end 25 | if(length(s1)>1 || length(s2)>1) 26 | error('can not merge struct arrays'); 27 | end 28 | fn=fieldnames(s2); 29 | s=s1; 30 | for i=1:length(fn) 31 | s=setfield(s,fn{i},getfield(s2,fn{i})); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/nnCostFunction.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/nnCostFunction.m -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/predict.m: -------------------------------------------------------------------------------- 1 | function p = predict(Theta1, Theta2, X) 2 | %PREDICT Predict the label of an input given a trained neural network 3 | % p = PREDICT(Theta1, Theta2, X) outputs the predicted label of X given the 4 | % trained weights of a neural network (Theta1, Theta2) 5 | 6 | % Useful values 7 | m = size(X, 1); 8 | num_labels = size(Theta2, 1); 9 | 10 | % You need to return the following variables correctly 11 | p = zeros(size(X, 1), 1); 12 | 13 | h1 = sigmoid([ones(m, 1) X] * Theta1'); 14 | h2 = sigmoid([ones(m, 1) h1] * Theta2'); 15 | [dummy, p] = max(h2, [], 2); 16 | 17 | % ========================================================================= 18 | 19 | 20 | end 21 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/randInitializeWeights.m: -------------------------------------------------------------------------------- 1 | function W = randInitializeWeights(L_in, L_out) 2 | %RANDINITIALIZEWEIGHTS Randomly initialize the weights of a layer with L_in 3 | %incoming connections and L_out outgoing connections 4 | % W = RANDINITIALIZEWEIGHTS(L_in, L_out) randomly initializes the weights 5 | % of a layer with L_in incoming connections and L_out outgoing 6 | % connections. 7 | % 8 | % Note that W should be set to a matrix of size(L_out, 1 + L_in) as 9 | % the first column of W handles the "bias" terms 10 | % 11 | 12 | % You need to return the following variables correctly 13 | W = zeros(L_out, 1 + L_in); 14 | 15 | % ====================== YOUR CODE HERE ====================== 16 | % Instructions: Initialize W randomly so that we break the symmetry while 17 | % training the neural network. 18 | % 19 | % Note: The first column of W corresponds to the parameters for the bias unit 20 | % 21 | %epsilon = sqrt(6)/sqrt(L_in + L_out); 22 | epsilon = 0.12; 23 | W = rand(L_out,L_in + 1)*2*epsilon - epsilon; 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | % ========================================================================= 33 | 34 | end 35 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/sigmoid.m: -------------------------------------------------------------------------------- 1 | function g = sigmoid(z) 2 | %SIGMOID Compute sigmoid functoon 3 | % J = SIGMOID(z) computes the sigmoid of z. 4 | 5 | g = 1.0 ./ (1.0 + exp(-z)); 6 | end 7 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/sigmoidGradient.m: -------------------------------------------------------------------------------- 1 | function g = sigmoidGradient(z) 2 | %SIGMOIDGRADIENT returns the gradient of the sigmoid function 3 | %evaluated at z 4 | % g = SIGMOIDGRADIENT(z) computes the gradient of the sigmoid function 5 | % evaluated at z. This should work regardless if z is a matrix or a 6 | % vector. In particular, if z is a vector or matrix, you should return 7 | % the gradient for each element. 8 | 9 | g = zeros(size(z)); 10 | 11 | % ====================== YOUR CODE HERE ====================== 12 | % Instructions: Compute the gradient of the sigmoid function evaluated at 13 | % each value of z (z can be a matrix, vector or scalar). 14 | 15 | g = sigmoid(z).*(1-sigmoid(z)); 16 | 17 | 18 | % ============================================================= 19 | 20 | 21 | 22 | 23 | end 24 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/submit.m: -------------------------------------------------------------------------------- 1 | function submit() 2 | addpath('./lib'); 3 | 4 | conf.assignmentSlug = 'neural-network-learning'; 5 | conf.itemName = 'Neural Networks Learning'; 6 | conf.partArrays = { ... 7 | { ... 8 | '1', ... 9 | { 'nnCostFunction.m' }, ... 10 | 'Feedforward and Cost Function', ... 11 | }, ... 12 | { ... 13 | '2', ... 14 | { 'nnCostFunction.m' }, ... 15 | 'Regularized Cost Function', ... 16 | }, ... 17 | { ... 18 | '3', ... 19 | { 'sigmoidGradient.m' }, ... 20 | 'Sigmoid Gradient', ... 21 | }, ... 22 | { ... 23 | '4', ... 24 | { 'nnCostFunction.m' }, ... 25 | 'Neural Network Gradient (Backpropagation)', ... 26 | }, ... 27 | { ... 28 | '5', ... 29 | { 'nnCostFunction.m' }, ... 30 | 'Regularized Gradient', ... 31 | }, ... 32 | }; 33 | conf.output = @output; 34 | 35 | submitWithConfiguration(conf); 36 | end 37 | 38 | function out = output(partId, auxstring) 39 | % Random Test Cases 40 | X = reshape(3 * sin(1:1:30), 3, 10); 41 | Xm = reshape(sin(1:32), 16, 2) / 5; 42 | ym = 1 + mod(1:16,4)'; 43 | t1 = sin(reshape(1:2:24, 4, 3)); 44 | t2 = cos(reshape(1:2:40, 4, 5)); 45 | t = [t1(:) ; t2(:)]; 46 | if partId == '1' 47 | [J] = nnCostFunction(t, 2, 4, 4, Xm, ym, 0); 48 | out = sprintf('%0.5f ', J); 49 | elseif partId == '2' 50 | [J] = nnCostFunction(t, 2, 4, 4, Xm, ym, 1.5); 51 | out = sprintf('%0.5f ', J); 52 | elseif partId == '3' 53 | out = sprintf('%0.5f ', sigmoidGradient(X)); 54 | elseif partId == '4' 55 | [J, grad] = nnCostFunction(t, 2, 4, 4, Xm, ym, 0); 56 | out = sprintf('%0.5f ', J); 57 | out = [out sprintf('%0.5f ', grad)]; 58 | elseif partId == '5' 59 | [J, grad] = nnCostFunction(t, 2, 4, 4, Xm, ym, 1.5); 60 | out = sprintf('%0.5f ', J); 61 | out = [out sprintf('%0.5f ', grad)]; 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/token.mat: -------------------------------------------------------------------------------- 1 | # Created by Octave 5.2.0, Sun Sep 20 11:22:25 2020 GMT 2 | # name: email 3 | # type: sq_string 4 | # elements: 1 5 | # length: 24 6 | three3.sun.rui@gmail.com 7 | 8 | 9 | # name: token 10 | # type: sq_string 11 | # elements: 1 12 | # length: 16 13 | zbzURkYXF8qRT7IS 14 | 15 | 16 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex4/machine-learning-ex4/ex4/varargin2struct.m: -------------------------------------------------------------------------------- 1 | function opt=varargin2struct(varargin) 2 | % 3 | % opt=varargin2struct('param1',value1,'param2',value2,...) 4 | % or 5 | % opt=varargin2struct(...,optstruct,...) 6 | % 7 | % convert a series of input parameters into a structure 8 | % 9 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 10 | % date: 2012/12/22 11 | % 12 | % input: 13 | % 'param', value: the input parameters should be pairs of a string and a value 14 | % optstruct: if a parameter is a struct, the fields will be merged to the output struct 15 | % 16 | % output: 17 | % opt: a struct where opt.param1=value1, opt.param2=value2 ... 18 | % 19 | % license: 20 | % BSD, see LICENSE_BSD.txt files for details 21 | % 22 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 23 | % 24 | 25 | len=length(varargin); 26 | opt=struct; 27 | if(len==0) return; end 28 | i=1; 29 | while(i<=len) 30 | if(isstruct(varargin{i})) 31 | opt=mergestruct(opt,varargin{i}); 32 | elseif(ischar(varargin{i}) && i or 11 | 12 | 13 | The script loadjson.m was built upon previous works by 14 | 15 | - Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713 16 | date: 2009/11/02 17 | - François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393 18 | date: 2009/03/22 19 | - Joel Feenstra: http://www.mathworks.com/matlabcentral/fileexchange/20565 20 | date: 2008/07/03 21 | 22 | 23 | This toolbox contains patches submitted by the following contributors: 24 | 25 | - Blake Johnson 26 | part of revision 341 27 | 28 | - Niclas Borlin 29 | various fixes in revision 394, including 30 | - loadjson crashes for all-zero sparse matrix. 31 | - loadjson crashes for empty sparse matrix. 32 | - Non-zero size of 0-by-N and N-by-0 empty matrices is lost after savejson/loadjson. 33 | - loadjson crashes for sparse real column vector. 34 | - loadjson crashes for sparse complex column vector. 35 | - Data is corrupted by savejson for sparse real row vector. 36 | - savejson crashes for sparse complex row vector. 37 | 38 | - Yul Kang 39 | patches for svn revision 415. 40 | - savejson saves an empty cell array as [] instead of null 41 | - loadjson differentiates an empty struct from an empty array 42 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/ex5/lib/jsonlab/LICENSE_BSD.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011-2015 Qianqian Fang . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are 4 | permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of 7 | conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 10 | of conditions and the following disclaimer in the documentation and/or other materials 11 | provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY EXPRESS OR IMPLIED 14 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 16 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 21 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | The views and conclusions contained in the software and documentation are those of the 24 | authors and should not be interpreted as representing official policies, either expressed 25 | or implied, of the copyright holders. 26 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/ex5/lib/jsonlab/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/ex5/lib/jsonlab/README.txt -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/ex5/lib/jsonlab/jsonopt.m: -------------------------------------------------------------------------------- 1 | function val=jsonopt(key,default,varargin) 2 | % 3 | % val=jsonopt(key,default,optstruct) 4 | % 5 | % setting options based on a struct. The struct can be produced 6 | % by varargin2struct from a list of 'param','value' pairs 7 | % 8 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 9 | % 10 | % $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $ 11 | % 12 | % input: 13 | % key: a string with which one look up a value from a struct 14 | % default: if the key does not exist, return default 15 | % optstruct: a struct where each sub-field is a key 16 | % 17 | % output: 18 | % val: if key exists, val=optstruct.key; otherwise val=default 19 | % 20 | % license: 21 | % BSD, see LICENSE_BSD.txt files for details 22 | % 23 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 24 | % 25 | 26 | val=default; 27 | if(nargin<=2) return; end 28 | opt=varargin{1}; 29 | if(isstruct(opt) && isfield(opt,key)) 30 | val=getfield(opt,key); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/ex5/lib/jsonlab/mergestruct.m: -------------------------------------------------------------------------------- 1 | function s=mergestruct(s1,s2) 2 | % 3 | % s=mergestruct(s1,s2) 4 | % 5 | % merge two struct objects into one 6 | % 7 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 8 | % date: 2012/12/22 9 | % 10 | % input: 11 | % s1,s2: a struct object, s1 and s2 can not be arrays 12 | % 13 | % output: 14 | % s: the merged struct object. fields in s1 and s2 will be combined in s. 15 | % 16 | % license: 17 | % BSD, see LICENSE_BSD.txt files for details 18 | % 19 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 20 | % 21 | 22 | if(~isstruct(s1) || ~isstruct(s2)) 23 | error('input parameters contain non-struct'); 24 | end 25 | if(length(s1)>1 || length(s2)>1) 26 | error('can not merge struct arrays'); 27 | end 28 | fn=fieldnames(s2); 29 | s=s1; 30 | for i=1:length(fn) 31 | s=setfield(s,fn{i},getfield(s2,fn{i})); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/ex5/lib/jsonlab/varargin2struct.m: -------------------------------------------------------------------------------- 1 | function opt=varargin2struct(varargin) 2 | % 3 | % opt=varargin2struct('param1',value1,'param2',value2,...) 4 | % or 5 | % opt=varargin2struct(...,optstruct,...) 6 | % 7 | % convert a series of input parameters into a structure 8 | % 9 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 10 | % date: 2012/12/22 11 | % 12 | % input: 13 | % 'param', value: the input parameters should be pairs of a string and a value 14 | % optstruct: if a parameter is a struct, the fields will be merged to the output struct 15 | % 16 | % output: 17 | % opt: a struct where opt.param1=value1, opt.param2=value2 ... 18 | % 19 | % license: 20 | % BSD, see LICENSE_BSD.txt files for details 21 | % 22 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 23 | % 24 | 25 | len=length(varargin); 26 | opt=struct; 27 | if(len==0) return; end 28 | i=1; 29 | while(i<=len) 30 | if(isstruct(varargin{i})) 31 | opt=mergestruct(opt,varargin{i}); 32 | elseif(ischar(varargin{i}) && i 2 | # name: email 3 | # type: sq_string 4 | # elements: 1 5 | # length: 24 6 | three3.sun.rui@gmail.com 7 | 8 | 9 | # name: token 10 | # type: sq_string 11 | # elements: 1 12 | # length: 16 13 | qdqWF5UVNACk5ECO 14 | 15 | 16 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/ex5/trainLinearReg.m: -------------------------------------------------------------------------------- 1 | function [theta] = trainLinearReg(X, y, lambda) 2 | %TRAINLINEARREG Trains linear regression given a dataset (X, y) and a 3 | %regularization parameter lambda 4 | % [theta] = TRAINLINEARREG (X, y, lambda) trains linear regression using 5 | % the dataset (X, y) and regularization parameter lambda. Returns the 6 | % trained parameters theta. 7 | % 8 | 9 | % Initialize Theta 10 | initial_theta = zeros(size(X, 2), 1); 11 | 12 | % Create "short hand" for the cost function to be minimized 13 | costFunction = @(t) linearRegCostFunction(X, y, t, lambda); 14 | 15 | % Now, costFunction is a function that takes in only one argument 16 | options = optimset('MaxIter', 200, 'GradObj', 'on'); 17 | 18 | % Minimize using fmincg 19 | theta = fmincg(costFunction, initial_theta, options); 20 | 21 | end 22 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/ex5/validationCurve.m: -------------------------------------------------------------------------------- 1 | function [lambda_vec, error_train, error_val] = ... 2 | validationCurve(X, y, Xval, yval) 3 | %VALIDATIONCURVE Generate the train and validation errors needed to 4 | %plot a validation curve that we can use to select lambda 5 | % [lambda_vec, error_train, error_val] = ... 6 | % VALIDATIONCURVE(X, y, Xval, yval) returns the train 7 | % and validation errors (in error_train, error_val) 8 | % for different values of lambda. You are given the training set (X, 9 | % y) and validation set (Xval, yval). 10 | % 11 | 12 | % Selected values of lambda (you should not change this) 13 | lambda_vec = [0 0.001 0.003 0.01 0.03 0.1 0.3 1 3 10]'; 14 | 15 | % You need to return these variables correctly. 16 | error_train = zeros(length(lambda_vec), 1); 17 | error_val = zeros(length(lambda_vec), 1); 18 | 19 | % ====================== YOUR CODE HERE ====================== 20 | % Instructions: Fill in this function to return training errors in 21 | % error_train and the validation errors in error_val. The 22 | % vector lambda_vec contains the different lambda parameters 23 | % to use for each calculation of the errors, i.e, 24 | % error_train(i), and error_val(i) should give 25 | % you the errors obtained after training with 26 | % lambda = lambda_vec(i) 27 | % 28 | % Note: You can loop over lambda_vec with the following: 29 | % 30 | % for i = 1:length(lambda_vec) 31 | % lambda = lambda_vec(i); 32 | % % Compute train / val errors when training linear 33 | % % regression with regularization parameter lambda 34 | % % You should store the result in error_train(i) 35 | % % and error_val(i) 36 | % .... 37 | % 38 | % end 39 | % 40 | % 41 | 42 | for i = 1:length(lambda_vec) 43 | lambda = lambda_vec(i); 44 | 45 | theta = trainLinearReg(X, y, lambda); 46 | 47 | error_train(i) = linearRegCostFunction(X, y, theta, 0); 48 | error_val(i) = linearRegCostFunction(Xval, yval, theta, 0); 49 | end 50 | 51 | 52 | % ========================================================================= 53 | 54 | end 55 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/learning curve1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/learning curve1.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/learning curve2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/learning curve2.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/linear fit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/linear fit.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/original data.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/original data.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/polynomial regression fit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex5/machine-learning-ex5/polynomial regression fit.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/Example Dataset 2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/Example Dataset 2.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/Example Dataset 3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/Example Dataset 3.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/Example Dataset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/Example Dataset.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/SVM (Gaussian Kernel) Decision Boundary (Example Dataset 3).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/SVM (Gaussian Kernel) Decision Boundary (Example Dataset 3).jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/SVM (Gaussian Kernel) Decision Boundary.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/SVM (Gaussian Kernel) Decision Boundary.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/SVM Decision Boundary with C = 1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/SVM Decision Boundary with C = 1.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/SVM Decision Boundary with C = 100 (Example Dataset 1).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/SVM Decision Boundary with C = 100 (Example Dataset 1).jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/emailSample3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/emailSample3.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/ex6.pdf -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/Sample3.txt: -------------------------------------------------------------------------------- 1 | With a MasterTrack™ Certificate, you'll have the flexibility to take courses and participate in live, interactive sessions with a group of high-caliber peers—entirely online. Build in-demand skills, earn credit toward the Master of Computer Science degree program and boost your resume with a certificate from the well-known and #1 ranked institution for innovation, Arizona State University. 2 | 3 | You'll have access to graded feedback from instructors, live instruction from ASU's world-renowned faculty, and the opportunity to study with a cohort of like minded and driven peers. 4 | 5 | Why are MasterTrack™ Certificates on Coursera unique? 6 | Top Quality - We partner with leading universities to deliver the best programs online. 7 | Affordable - Earn a high-quality, career-focused certificate for much less than equivalent on-campus programs. 8 | Interactive - Benefit from team-based learning and live interaction with instructors. 9 | Modular and Stackable - With a MasterTrack™ you can start working towards your Masters of Computer Science today! -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/dataset3Params.m: -------------------------------------------------------------------------------- 1 | function [C, sigma] = dataset3Params(X, y, Xval, yval) 2 | %DATASET3PARAMS returns your choice of C and sigma for Part 3 of the exercise 3 | %where you select the optimal (C, sigma) learning parameters to use for SVM 4 | %with RBF kernel 5 | % [C, sigma] = DATASET3PARAMS(X, y, Xval, yval) returns your choice of C and 6 | % sigma. You should complete this function to return the optimal C and 7 | % sigma based on a cross-validation set. 8 | % 9 | 10 | % You need to return the following variables correctly. 11 | C = 1; 12 | sigma = 0.3; 13 | 14 | % ====================== YOUR CODE HERE ====================== 15 | % Instructions: Fill in this function to return the optimal C and sigma 16 | % learning parameters found using the cross validation set. 17 | % You can use svmPredict to predict the labels on the cross 18 | % validation set. For example, 19 | % predictions = svmPredict(model, Xval); 20 | % will return the predictions on the cross validation set. 21 | % 22 | % Note: You can compute the prediction error using 23 | % mean(double(predictions ~= yval)) 24 | % 25 | results = eye(64,3); 26 | errorRow = 0; 27 | 28 | for C_test = [0.01 0.03 0.1 0.3 1, 3, 10 30] 29 | for sigma_test = [0.01 0.03 0.1 0.3 1, 3, 10 30] 30 | errorRow = errorRow + 1; 31 | model = svmTrain(X, y, C_test, @(x1, x2) gaussianKernel(x1, x2, sigma_test)); 32 | predictions = svmPredict(model, Xval); 33 | prediction_error = mean(double(predictions ~= yval)); 34 | 35 | results(errorRow,:) = [C_test, sigma_test, prediction_error]; 36 | end 37 | end 38 | 39 | sorted_results = sortrows(results, 3); 40 | C = sorted_results(1,1); 41 | sigma = sorted_results(1,2); 42 | 43 | % ========================================================================= 44 | 45 | end 46 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/emailSample1.txt: -------------------------------------------------------------------------------- 1 | > Anyone knows how much it costs to host a web portal ? 2 | > 3 | Well, it depends on how many visitors you're expecting. 4 | This can be anywhere from less than 10 bucks a month to a couple of $100. 5 | You should checkout http://www.rackspace.com/ or perhaps Amazon EC2 6 | if youre running something big.. 7 | 8 | To unsubscribe yourself from this mailing list, send an email to: 9 | groupname-unsubscribe@egroups.com 10 | 11 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/emailSample2.txt: -------------------------------------------------------------------------------- 1 | Folks, 2 | 3 | my first time posting - have a bit of Unix experience, but am new to Linux. 4 | 5 | 6 | Just got a new PC at home - Dell box with Windows XP. Added a second hard disk 7 | for Linux. Partitioned the disk and have installed Suse 7.2 from CD, which went 8 | fine except it didn't pick up my monitor. 9 | 10 | I have a Dell branded E151FPp 15" LCD flat panel monitor and a nVidia GeForce4 11 | Ti4200 video card, both of which are probably too new to feature in Suse's default 12 | set. I downloaded a driver from the nVidia website and installed it using RPM. 13 | Then I ran Sax2 (as was recommended in some postings I found on the net), but 14 | it still doesn't feature my video card in the available list. What next? 15 | 16 | Another problem. I have a Dell branded keyboard and if I hit Caps-Lock twice, 17 | the whole machine crashes (in Linux, not Windows) - even the on/off switch is 18 | inactive, leaving me to reach for the power cable instead. 19 | 20 | If anyone can help me in any way with these probs., I'd be really grateful - 21 | I've searched the 'net but have run out of ideas. 22 | 23 | Or should I be going for a different version of Linux such as RedHat? Opinions 24 | welcome. 25 | 26 | Thanks a lot, 27 | Peter 28 | 29 | -- 30 | Irish Linux Users' Group: ilug@linux.ie 31 | http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information. 32 | List maintainer: listmaster@linux.ie 33 | 34 | 35 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/ex6data1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/ex6data1.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/ex6data2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/ex6data2.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/ex6data3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/ex6data3.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/gaussianKernel.m: -------------------------------------------------------------------------------- 1 | function sim = gaussianKernel(x1, x2, sigma) 2 | %RBFKERNEL returns a radial basis function kernel between x1 and x2 3 | % sim = gaussianKernel(x1, x2) returns a gaussian kernel between x1 and x2 4 | % and returns the value in sim 5 | 6 | % Ensure that x1 and x2 are column vectors 7 | x1 = x1(:); x2 = x2(:); 8 | 9 | % You need to return the following variables correctly. 10 | sim = 0; 11 | 12 | % ====================== YOUR CODE HERE ====================== 13 | % Instructions: Fill in this function to return the similarity between x1 14 | % and x2 computed using a Gaussian kernel with bandwidth 15 | % sigma 16 | % 17 | % 18 | sim = exp(-sum((x1-x2).^2)/(2*sigma^2)); 19 | 20 | 21 | 22 | 23 | 24 | % ============================================================= 25 | 26 | end 27 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/getVocabList.m: -------------------------------------------------------------------------------- 1 | function vocabList = getVocabList() 2 | %GETVOCABLIST reads the fixed vocabulary list in vocab.txt and returns a 3 | %cell array of the words 4 | % vocabList = GETVOCABLIST() reads the fixed vocabulary list in vocab.txt 5 | % and returns a cell array of the words in vocabList. 6 | 7 | 8 | %% Read the fixed vocabulary list 9 | fid = fopen('vocab.txt'); 10 | 11 | % Store all dictionary words in cell array vocab{} 12 | n = 1899; % Total number of words in the dictionary 13 | 14 | % For ease of implementation, we use a struct to map the strings => integers 15 | % In practice, you'll want to use some form of hashmap 16 | vocabList = cell(n, 1); 17 | for i = 1:n 18 | % Word Index (can ignore since it will be = i) 19 | fscanf(fid, '%d', 1); 20 | % Actual Word 21 | vocabList{i} = fscanf(fid, '%s', 1); 22 | end 23 | fclose(fid); 24 | 25 | end 26 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/lib/jsonlab/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | The author of "jsonlab" toolbox is Qianqian Fang. Qianqian 2 | is currently an Assistant Professor at Massachusetts General Hospital, 3 | Harvard Medical School. 4 | 5 | Address: Martinos Center for Biomedical Imaging, 6 | Massachusetts General Hospital, 7 | Harvard Medical School 8 | Bldg 149, 13th St, Charlestown, MA 02129, USA 9 | URL: http://nmr.mgh.harvard.edu/~fangq/ 10 | Email: or 11 | 12 | 13 | The script loadjson.m was built upon previous works by 14 | 15 | - Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713 16 | date: 2009/11/02 17 | - François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393 18 | date: 2009/03/22 19 | - Joel Feenstra: http://www.mathworks.com/matlabcentral/fileexchange/20565 20 | date: 2008/07/03 21 | 22 | 23 | This toolbox contains patches submitted by the following contributors: 24 | 25 | - Blake Johnson 26 | part of revision 341 27 | 28 | - Niclas Borlin 29 | various fixes in revision 394, including 30 | - loadjson crashes for all-zero sparse matrix. 31 | - loadjson crashes for empty sparse matrix. 32 | - Non-zero size of 0-by-N and N-by-0 empty matrices is lost after savejson/loadjson. 33 | - loadjson crashes for sparse real column vector. 34 | - loadjson crashes for sparse complex column vector. 35 | - Data is corrupted by savejson for sparse real row vector. 36 | - savejson crashes for sparse complex row vector. 37 | 38 | - Yul Kang 39 | patches for svn revision 415. 40 | - savejson saves an empty cell array as [] instead of null 41 | - loadjson differentiates an empty struct from an empty array 42 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/lib/jsonlab/LICENSE_BSD.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011-2015 Qianqian Fang . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are 4 | permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of 7 | conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 10 | of conditions and the following disclaimer in the documentation and/or other materials 11 | provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY EXPRESS OR IMPLIED 14 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 16 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 21 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | The views and conclusions contained in the software and documentation are those of the 24 | authors and should not be interpreted as representing official policies, either expressed 25 | or implied, of the copyright holders. 26 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/lib/jsonlab/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/lib/jsonlab/README.txt -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/lib/jsonlab/jsonopt.m: -------------------------------------------------------------------------------- 1 | function val=jsonopt(key,default,varargin) 2 | % 3 | % val=jsonopt(key,default,optstruct) 4 | % 5 | % setting options based on a struct. The struct can be produced 6 | % by varargin2struct from a list of 'param','value' pairs 7 | % 8 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 9 | % 10 | % $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $ 11 | % 12 | % input: 13 | % key: a string with which one look up a value from a struct 14 | % default: if the key does not exist, return default 15 | % optstruct: a struct where each sub-field is a key 16 | % 17 | % output: 18 | % val: if key exists, val=optstruct.key; otherwise val=default 19 | % 20 | % license: 21 | % BSD, see LICENSE_BSD.txt files for details 22 | % 23 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 24 | % 25 | 26 | val=default; 27 | if(nargin<=2) return; end 28 | opt=varargin{1}; 29 | if(isstruct(opt) && isfield(opt,key)) 30 | val=getfield(opt,key); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/lib/jsonlab/mergestruct.m: -------------------------------------------------------------------------------- 1 | function s=mergestruct(s1,s2) 2 | % 3 | % s=mergestruct(s1,s2) 4 | % 5 | % merge two struct objects into one 6 | % 7 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 8 | % date: 2012/12/22 9 | % 10 | % input: 11 | % s1,s2: a struct object, s1 and s2 can not be arrays 12 | % 13 | % output: 14 | % s: the merged struct object. fields in s1 and s2 will be combined in s. 15 | % 16 | % license: 17 | % BSD, see LICENSE_BSD.txt files for details 18 | % 19 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 20 | % 21 | 22 | if(~isstruct(s1) || ~isstruct(s2)) 23 | error('input parameters contain non-struct'); 24 | end 25 | if(length(s1)>1 || length(s2)>1) 26 | error('can not merge struct arrays'); 27 | end 28 | fn=fieldnames(s2); 29 | s=s1; 30 | for i=1:length(fn) 31 | s=setfield(s,fn{i},getfield(s2,fn{i})); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/lib/jsonlab/varargin2struct.m: -------------------------------------------------------------------------------- 1 | function opt=varargin2struct(varargin) 2 | % 3 | % opt=varargin2struct('param1',value1,'param2',value2,...) 4 | % or 5 | % opt=varargin2struct(...,optstruct,...) 6 | % 7 | % convert a series of input parameters into a structure 8 | % 9 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 10 | % date: 2012/12/22 11 | % 12 | % input: 13 | % 'param', value: the input parameters should be pairs of a string and a value 14 | % optstruct: if a parameter is a struct, the fields will be merged to the output struct 15 | % 16 | % output: 17 | % opt: a struct where opt.param1=value1, opt.param2=value2 ... 18 | % 19 | % license: 20 | % BSD, see LICENSE_BSD.txt files for details 21 | % 22 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 23 | % 24 | 25 | len=length(varargin); 26 | opt=struct; 27 | if(len==0) return; end 28 | i=1; 29 | while(i<=len) 30 | if(isstruct(varargin{i})) 31 | opt=mergestruct(opt,varargin{i}); 32 | elseif(ischar(varargin{i}) && i= 0) = 1; 51 | pred(p < 0) = 0; 52 | 53 | end 54 | 55 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/token.mat: -------------------------------------------------------------------------------- 1 | # Created by Octave 5.2.0, Sat Sep 26 20:07:49 2020 GMT 2 | # name: email 3 | # type: sq_string 4 | # elements: 1 5 | # length: 24 6 | three3.sun.rui@gmail.com 7 | 8 | 9 | # name: token 10 | # type: sq_string 11 | # elements: 1 12 | # length: 16 13 | vA3os3kt2XtX9KQB 14 | 15 | 16 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/visualizeBoundary.m: -------------------------------------------------------------------------------- 1 | function visualizeBoundary(X, y, model, varargin) 2 | %VISUALIZEBOUNDARY plots a non-linear decision boundary learned by the SVM 3 | % VISUALIZEBOUNDARYLINEAR(X, y, model) plots a non-linear decision 4 | % boundary learned by the SVM and overlays the data on it 5 | 6 | % Plot the training data on top of the boundary 7 | plotData(X, y) 8 | 9 | % Make classification predictions over a grid of values 10 | x1plot = linspace(min(X(:,1)), max(X(:,1)), 100)'; 11 | x2plot = linspace(min(X(:,2)), max(X(:,2)), 100)'; 12 | [X1, X2] = meshgrid(x1plot, x2plot); 13 | vals = zeros(size(X1)); 14 | for i = 1:size(X1, 2) 15 | this_X = [X1(:, i), X2(:, i)]; 16 | vals(:, i) = svmPredict(model, this_X); 17 | end 18 | 19 | % Plot the SVM boundary 20 | hold on 21 | contour(X1, X2, vals, [0.5 0.5], 'b'); 22 | hold off; 23 | 24 | end 25 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/ex6/visualizeBoundaryLinear.m: -------------------------------------------------------------------------------- 1 | function visualizeBoundaryLinear(X, y, model) 2 | %VISUALIZEBOUNDARYLINEAR plots a linear decision boundary learned by the 3 | %SVM 4 | % VISUALIZEBOUNDARYLINEAR(X, y, model) plots a linear decision boundary 5 | % learned by the SVM and overlays the data on it 6 | 7 | w = model.w; 8 | b = model.b; 9 | xp = linspace(min(X(:,1)), max(X(:,1)), 100); 10 | yp = - (w(1)*xp + b)/w(2); 11 | plotData(X, y); 12 | hold on; 13 | plot(xp, yp, '-b'); 14 | hold off 15 | 16 | end 17 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex6/original email.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex6/original email.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/2D visualization produced using PCA.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/2D visualization produced using PCA.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_image compression.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_image compression.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_iter=1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_iter=1.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_iter=10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_iter=10.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_iter=5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_iter=5.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_iter=7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Clustering_iter=7.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Computed eigenvectors of the dataset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Computed eigenvectors of the dataset.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Faces dataset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Faces dataset.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Original data in 3D.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Original data in 3D.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Original images of faces and ones reconstructed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Original images of faces and ones reconstructed.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/Principal components on the face dataset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/Principal components on the face dataset.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/The normalized and projected data after PCA.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/The normalized and projected data after PCA.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/dataset for PCA.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/dataset for PCA.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/ex7.pdf -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/bird_small.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/bird_small.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/bird_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/bird_small.png -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/computeCentroids.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/computeCentroids.m -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/displayData.m: -------------------------------------------------------------------------------- 1 | function [h, display_array] = displayData(X, example_width) 2 | %DISPLAYDATA Display 2D data in a nice grid 3 | % [h, display_array] = DISPLAYDATA(X, example_width) displays 2D data 4 | % stored in X in a nice grid. It returns the figure handle h and the 5 | % displayed array if requested. 6 | 7 | % Set example_width automatically if not passed in 8 | if ~exist('example_width', 'var') || isempty(example_width) 9 | example_width = round(sqrt(size(X, 2))); 10 | end 11 | 12 | % Gray Image 13 | colormap(gray); 14 | 15 | % Compute rows, cols 16 | [m n] = size(X); 17 | example_height = (n / example_width); 18 | 19 | % Compute number of items to display 20 | display_rows = floor(sqrt(m)); 21 | display_cols = ceil(m / display_rows); 22 | 23 | % Between images padding 24 | pad = 1; 25 | 26 | % Setup blank display 27 | display_array = - ones(pad + display_rows * (example_height + pad), ... 28 | pad + display_cols * (example_width + pad)); 29 | 30 | % Copy each example into a patch on the display array 31 | curr_ex = 1; 32 | for j = 1:display_rows 33 | for i = 1:display_cols 34 | if curr_ex > m, 35 | break; 36 | end 37 | % Copy the patch 38 | 39 | % Get the max value of the patch 40 | max_val = max(abs(X(curr_ex, :))); 41 | display_array(pad + (j - 1) * (example_height + pad) + (1:example_height), ... 42 | pad + (i - 1) * (example_width + pad) + (1:example_width)) = ... 43 | reshape(X(curr_ex, :), example_height, example_width) / max_val; 44 | curr_ex = curr_ex + 1; 45 | end 46 | if curr_ex > m, 47 | break; 48 | end 49 | end 50 | 51 | % Display Image 52 | h = imagesc(display_array, [-1 1]); 53 | 54 | % Do not show axis 55 | axis image off 56 | 57 | drawnow; 58 | 59 | end 60 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/drawLine.m: -------------------------------------------------------------------------------- 1 | function drawLine(p1, p2, varargin) 2 | %DRAWLINE Draws a line from point p1 to point p2 3 | % DRAWLINE(p1, p2) Draws a line from point p1 to point p2 and holds the 4 | % current figure 5 | 6 | plot([p1(1) p2(1)], [p1(2) p2(2)], varargin{:}); 7 | 8 | end -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/ex7data1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/ex7data1.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/ex7data2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/ex7data2.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/ex7faces.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/ex7faces.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/featureNormalize.m: -------------------------------------------------------------------------------- 1 | function [X_norm, mu, sigma] = featureNormalize(X) 2 | %FEATURENORMALIZE Normalizes the features in X 3 | % FEATURENORMALIZE(X) returns a normalized version of X where 4 | % the mean value of each feature is 0 and the standard deviation 5 | % is 1. This is often a good preprocessing step to do when 6 | % working with learning algorithms. 7 | 8 | mu = mean(X); 9 | X_norm = bsxfun(@minus, X, mu); 10 | 11 | sigma = std(X_norm); 12 | X_norm = bsxfun(@rdivide, X_norm, sigma); 13 | 14 | 15 | % ============================================================ 16 | 17 | end 18 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/findClosestCentroids.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/findClosestCentroids.m -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/kMeansInitCentroids.m: -------------------------------------------------------------------------------- 1 | function centroids = kMeansInitCentroids(X, K) 2 | %KMEANSINITCENTROIDS This function initializes K centroids that are to be 3 | %used in K-Means on the dataset X 4 | % centroids = KMEANSINITCENTROIDS(X, K) returns K initial centroids to be 5 | % used with the K-Means on the dataset X 6 | % 7 | 8 | % You should return this values correctly 9 | centroids = zeros(K, size(X, 2)); 10 | 11 | % ====================== YOUR CODE HERE ====================== 12 | % Instructions: You should set centroids to randomly chosen examples from 13 | % the dataset X 14 | % 15 | % Initialize the centroids to be random examples 16 | % Randomly reorder the indices of examples 17 | randidx = randperm(size(X, 1)); 18 | % Take the first K examples as centroids 19 | centroids = X(randidx(1:K), :); 20 | 21 | % ============================================================= 22 | 23 | end 24 | 25 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/lib/jsonlab/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | The author of "jsonlab" toolbox is Qianqian Fang. Qianqian 2 | is currently an Assistant Professor at Massachusetts General Hospital, 3 | Harvard Medical School. 4 | 5 | Address: Martinos Center for Biomedical Imaging, 6 | Massachusetts General Hospital, 7 | Harvard Medical School 8 | Bldg 149, 13th St, Charlestown, MA 02129, USA 9 | URL: http://nmr.mgh.harvard.edu/~fangq/ 10 | Email: or 11 | 12 | 13 | The script loadjson.m was built upon previous works by 14 | 15 | - Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713 16 | date: 2009/11/02 17 | - François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393 18 | date: 2009/03/22 19 | - Joel Feenstra: http://www.mathworks.com/matlabcentral/fileexchange/20565 20 | date: 2008/07/03 21 | 22 | 23 | This toolbox contains patches submitted by the following contributors: 24 | 25 | - Blake Johnson 26 | part of revision 341 27 | 28 | - Niclas Borlin 29 | various fixes in revision 394, including 30 | - loadjson crashes for all-zero sparse matrix. 31 | - loadjson crashes for empty sparse matrix. 32 | - Non-zero size of 0-by-N and N-by-0 empty matrices is lost after savejson/loadjson. 33 | - loadjson crashes for sparse real column vector. 34 | - loadjson crashes for sparse complex column vector. 35 | - Data is corrupted by savejson for sparse real row vector. 36 | - savejson crashes for sparse complex row vector. 37 | 38 | - Yul Kang 39 | patches for svn revision 415. 40 | - savejson saves an empty cell array as [] instead of null 41 | - loadjson differentiates an empty struct from an empty array 42 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/lib/jsonlab/LICENSE_BSD.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011-2015 Qianqian Fang . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are 4 | permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of 7 | conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 10 | of conditions and the following disclaimer in the documentation and/or other materials 11 | provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY EXPRESS OR IMPLIED 14 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 16 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 21 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | The views and conclusions contained in the software and documentation are those of the 24 | authors and should not be interpreted as representing official policies, either expressed 25 | or implied, of the copyright holders. 26 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/lib/jsonlab/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/lib/jsonlab/README.txt -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/lib/jsonlab/jsonopt.m: -------------------------------------------------------------------------------- 1 | function val=jsonopt(key,default,varargin) 2 | % 3 | % val=jsonopt(key,default,optstruct) 4 | % 5 | % setting options based on a struct. The struct can be produced 6 | % by varargin2struct from a list of 'param','value' pairs 7 | % 8 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 9 | % 10 | % $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $ 11 | % 12 | % input: 13 | % key: a string with which one look up a value from a struct 14 | % default: if the key does not exist, return default 15 | % optstruct: a struct where each sub-field is a key 16 | % 17 | % output: 18 | % val: if key exists, val=optstruct.key; otherwise val=default 19 | % 20 | % license: 21 | % BSD, see LICENSE_BSD.txt files for details 22 | % 23 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 24 | % 25 | 26 | val=default; 27 | if(nargin<=2) return; end 28 | opt=varargin{1}; 29 | if(isstruct(opt) && isfield(opt,key)) 30 | val=getfield(opt,key); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/lib/jsonlab/mergestruct.m: -------------------------------------------------------------------------------- 1 | function s=mergestruct(s1,s2) 2 | % 3 | % s=mergestruct(s1,s2) 4 | % 5 | % merge two struct objects into one 6 | % 7 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 8 | % date: 2012/12/22 9 | % 10 | % input: 11 | % s1,s2: a struct object, s1 and s2 can not be arrays 12 | % 13 | % output: 14 | % s: the merged struct object. fields in s1 and s2 will be combined in s. 15 | % 16 | % license: 17 | % BSD, see LICENSE_BSD.txt files for details 18 | % 19 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 20 | % 21 | 22 | if(~isstruct(s1) || ~isstruct(s2)) 23 | error('input parameters contain non-struct'); 24 | end 25 | if(length(s1)>1 || length(s2)>1) 26 | error('can not merge struct arrays'); 27 | end 28 | fn=fieldnames(s2); 29 | s=s1; 30 | for i=1:length(fn) 31 | s=setfield(s,fn{i},getfield(s2,fn{i})); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex7/ex7/lib/jsonlab/varargin2struct.m: -------------------------------------------------------------------------------- 1 | function opt=varargin2struct(varargin) 2 | % 3 | % opt=varargin2struct('param1',value1,'param2',value2,...) 4 | % or 5 | % opt=varargin2struct(...,optstruct,...) 6 | % 7 | % convert a series of input parameters into a structure 8 | % 9 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 10 | % date: 2012/12/22 11 | % 12 | % input: 13 | % 'param', value: the input parameters should be pairs of a string and a value 14 | % optstruct: if a parameter is a struct, the fields will be merged to the output struct 15 | % 16 | % output: 17 | % opt: a struct where opt.param1=value1, opt.param2=value2 ... 18 | % 19 | % license: 20 | % BSD, see LICENSE_BSD.txt files for details 21 | % 22 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 23 | % 24 | 25 | len=length(varargin); 26 | opt=struct; 27 | if(len==0) return; end 28 | i=1; 29 | while(i<=len) 30 | if(isstruct(varargin{i})) 31 | opt=mergestruct(opt,varargin{i}); 32 | elseif(ischar(varargin{i}) && i 2 | # name: email 3 | # type: sq_string 4 | # elements: 1 5 | # length: 24 6 | three3.sun.rui@gmail.com 7 | 8 | 9 | # name: token 10 | # type: sq_string 11 | # elements: 1 12 | # length: 16 13 | Vyq6EqRFMrsSQ2bC 14 | 15 | 16 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex8/ex8.pdf -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/Gaussian distribution contours.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/Gaussian distribution contours.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/checkCostFunction.m: -------------------------------------------------------------------------------- 1 | function checkCostFunction(lambda) 2 | %CHECKCOSTFUNCTION Creates a collaborative filering problem 3 | %to check your cost function and gradients 4 | % CHECKCOSTFUNCTION(lambda) Creates a collaborative filering problem 5 | % to check your cost function and gradients, it will output the 6 | % analytical gradients produced by your code and the numerical gradients 7 | % (computed using computeNumericalGradient). These two gradient 8 | % computations should result in very similar values. 9 | 10 | % Set lambda 11 | if ~exist('lambda', 'var') || isempty(lambda) 12 | lambda = 0; 13 | end 14 | 15 | %% Create small problem 16 | X_t = rand(4, 3); 17 | Theta_t = rand(5, 3); 18 | 19 | % Zap out most entries 20 | Y = X_t * Theta_t'; 21 | Y(rand(size(Y)) > 0.5) = 0; 22 | R = zeros(size(Y)); 23 | R(Y ~= 0) = 1; 24 | 25 | %% Run Gradient Checking 26 | X = randn(size(X_t)); 27 | Theta = randn(size(Theta_t)); 28 | num_users = size(Y, 2); 29 | num_movies = size(Y, 1); 30 | num_features = size(Theta_t, 2); 31 | 32 | numgrad = computeNumericalGradient( ... 33 | @(t) cofiCostFunc(t, Y, R, num_users, num_movies, ... 34 | num_features, lambda), [X(:); Theta(:)]); 35 | 36 | [cost, grad] = cofiCostFunc([X(:); Theta(:)], Y, R, num_users, ... 37 | num_movies, num_features, lambda); 38 | 39 | disp([numgrad grad]); 40 | fprintf(['The above two columns you get should be very similar.\n' ... 41 | '(Left-Your Numerical Gradient, Right-Analytical Gradient)\n\n']); 42 | 43 | diff = norm(numgrad-grad)/norm(numgrad+grad); 44 | fprintf(['If your cost function implementation is correct, then \n' ... 45 | 'the relative difference will be small (less than 1e-9). \n' ... 46 | '\nRelative Difference: %g\n'], diff); 47 | 48 | end -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/classified anomalies.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/classified anomalies.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/computeNumericalGradient.m: -------------------------------------------------------------------------------- 1 | function numgrad = computeNumericalGradient(J, theta) 2 | %COMPUTENUMERICALGRADIENT Computes the gradient using "finite differences" 3 | %and gives us a numerical estimate of the gradient. 4 | % numgrad = COMPUTENUMERICALGRADIENT(J, theta) computes the numerical 5 | % gradient of the function J around theta. Calling y = J(theta) should 6 | % return the function value at theta. 7 | 8 | % Notes: The following code implements numerical gradient checking, and 9 | % returns the numerical gradient.It sets numgrad(i) to (a numerical 10 | % approximation of) the partial derivative of J with respect to the 11 | % i-th input argument, evaluated at theta. (i.e., numgrad(i) should 12 | % be the (approximately) the partial derivative of J with respect 13 | % to theta(i).) 14 | % 15 | 16 | numgrad = zeros(size(theta)); 17 | perturb = zeros(size(theta)); 18 | e = 1e-4; 19 | for p = 1:numel(theta) 20 | % Set perturbation vector 21 | perturb(p) = e; 22 | loss1 = J(theta - perturb); 23 | loss2 = J(theta + perturb); 24 | % Compute Numerical Gradient 25 | numgrad(p) = (loss2 - loss1) / (2*e); 26 | perturb(p) = 0; 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/estimateGaussian.m: -------------------------------------------------------------------------------- 1 | function [mu sigma2] = estimateGaussian(X) 2 | %ESTIMATEGAUSSIAN This function estimates the parameters of a 3 | %Gaussian distribution using the data in X 4 | % [mu sigma2] = estimateGaussian(X), 5 | % The input X is the dataset with each n-dimensional data point in one row 6 | % The output is an n-dimensional vector mu, the mean of the data set 7 | % and the variances sigma^2, an n x 1 vector 8 | % 9 | 10 | % Useful variables 11 | [m, n] = size(X); 12 | 13 | % You should return these values correctly 14 | mu = zeros(n, 1); 15 | sigma2 = zeros(n, 1); 16 | 17 | % ====================== YOUR CODE HERE ====================== 18 | % Instructions: Compute the mean of the data and the variances 19 | % In particular, mu(i) should contain the mean of 20 | % the data for the i-th feature and sigma2(i) 21 | % should contain variance of the i-th feature. 22 | % 23 | 24 | 25 | mu = 1/m * sum(X); 26 | 27 | sigma2 = 1/m * sum((X - repmat(mu, m, 1)).^2); 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | % ============================================================= 36 | 37 | 38 | end 39 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/ex8_movieParams.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/ex8_movieParams.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/ex8_movies.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/ex8_movies.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/ex8data1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/ex8data1.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/ex8data2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/ex8data2.mat -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/first dataset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/first dataset.jpg -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/lib/jsonlab/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | The author of "jsonlab" toolbox is Qianqian Fang. Qianqian 2 | is currently an Assistant Professor at Massachusetts General Hospital, 3 | Harvard Medical School. 4 | 5 | Address: Martinos Center for Biomedical Imaging, 6 | Massachusetts General Hospital, 7 | Harvard Medical School 8 | Bldg 149, 13th St, Charlestown, MA 02129, USA 9 | URL: http://nmr.mgh.harvard.edu/~fangq/ 10 | Email: or 11 | 12 | 13 | The script loadjson.m was built upon previous works by 14 | 15 | - Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713 16 | date: 2009/11/02 17 | - François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393 18 | date: 2009/03/22 19 | - Joel Feenstra: http://www.mathworks.com/matlabcentral/fileexchange/20565 20 | date: 2008/07/03 21 | 22 | 23 | This toolbox contains patches submitted by the following contributors: 24 | 25 | - Blake Johnson 26 | part of revision 341 27 | 28 | - Niclas Borlin 29 | various fixes in revision 394, including 30 | - loadjson crashes for all-zero sparse matrix. 31 | - loadjson crashes for empty sparse matrix. 32 | - Non-zero size of 0-by-N and N-by-0 empty matrices is lost after savejson/loadjson. 33 | - loadjson crashes for sparse real column vector. 34 | - loadjson crashes for sparse complex column vector. 35 | - Data is corrupted by savejson for sparse real row vector. 36 | - savejson crashes for sparse complex row vector. 37 | 38 | - Yul Kang 39 | patches for svn revision 415. 40 | - savejson saves an empty cell array as [] instead of null 41 | - loadjson differentiates an empty struct from an empty array 42 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/lib/jsonlab/LICENSE_BSD.txt: -------------------------------------------------------------------------------- 1 | Copyright 2011-2015 Qianqian Fang . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are 4 | permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of 7 | conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list 10 | of conditions and the following disclaimer in the documentation and/or other materials 11 | provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY EXPRESS OR IMPLIED 14 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 16 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 20 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 21 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | The views and conclusions contained in the software and documentation are those of the 24 | authors and should not be interpreted as representing official policies, either expressed 25 | or implied, of the copyright holders. 26 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/lib/jsonlab/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/lib/jsonlab/README.txt -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/lib/jsonlab/jsonopt.m: -------------------------------------------------------------------------------- 1 | function val=jsonopt(key,default,varargin) 2 | % 3 | % val=jsonopt(key,default,optstruct) 4 | % 5 | % setting options based on a struct. The struct can be produced 6 | % by varargin2struct from a list of 'param','value' pairs 7 | % 8 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 9 | % 10 | % $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $ 11 | % 12 | % input: 13 | % key: a string with which one look up a value from a struct 14 | % default: if the key does not exist, return default 15 | % optstruct: a struct where each sub-field is a key 16 | % 17 | % output: 18 | % val: if key exists, val=optstruct.key; otherwise val=default 19 | % 20 | % license: 21 | % BSD, see LICENSE_BSD.txt files for details 22 | % 23 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 24 | % 25 | 26 | val=default; 27 | if(nargin<=2) return; end 28 | opt=varargin{1}; 29 | if(isstruct(opt) && isfield(opt,key)) 30 | val=getfield(opt,key); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/lib/jsonlab/mergestruct.m: -------------------------------------------------------------------------------- 1 | function s=mergestruct(s1,s2) 2 | % 3 | % s=mergestruct(s1,s2) 4 | % 5 | % merge two struct objects into one 6 | % 7 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 8 | % date: 2012/12/22 9 | % 10 | % input: 11 | % s1,s2: a struct object, s1 and s2 can not be arrays 12 | % 13 | % output: 14 | % s: the merged struct object. fields in s1 and s2 will be combined in s. 15 | % 16 | % license: 17 | % BSD, see LICENSE_BSD.txt files for details 18 | % 19 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 20 | % 21 | 22 | if(~isstruct(s1) || ~isstruct(s2)) 23 | error('input parameters contain non-struct'); 24 | end 25 | if(length(s1)>1 || length(s2)>1) 26 | error('can not merge struct arrays'); 27 | end 28 | fn=fieldnames(s2); 29 | s=s1; 30 | for i=1:length(fn) 31 | s=setfield(s,fn{i},getfield(s2,fn{i})); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/lib/jsonlab/varargin2struct.m: -------------------------------------------------------------------------------- 1 | function opt=varargin2struct(varargin) 2 | % 3 | % opt=varargin2struct('param1',value1,'param2',value2,...) 4 | % or 5 | % opt=varargin2struct(...,optstruct,...) 6 | % 7 | % convert a series of input parameters into a structure 8 | % 9 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 10 | % date: 2012/12/22 11 | % 12 | % input: 13 | % 'param', value: the input parameters should be pairs of a string and a value 14 | % optstruct: if a parameter is a struct, the fields will be merged to the output struct 15 | % 16 | % output: 17 | % opt: a struct where opt.param1=value1, opt.param2=value2 ... 18 | % 19 | % license: 20 | % BSD, see LICENSE_BSD.txt files for details 21 | % 22 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 23 | % 24 | 25 | len=length(varargin); 26 | opt=struct; 27 | if(len==0) return; end 28 | i=1; 29 | while(i<=len) 30 | if(isstruct(varargin{i})) 31 | opt=mergestruct(opt,varargin{i}); 32 | elseif(ischar(varargin{i}) && i bestF1 39 | bestF1 = F1; 40 | bestEpsilon = epsilon; 41 | end 42 | end 43 | 44 | end 45 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/token.mat: -------------------------------------------------------------------------------- 1 | # Created by Octave 5.2.0, Sat Sep 26 20:09:25 2020 GMT 2 | # name: email 3 | # type: sq_string 4 | # elements: 1 5 | # length: 24 6 | three3.sun.rui@gmail.com 7 | 8 | 9 | # name: token 10 | # type: sq_string 11 | # elements: 1 12 | # length: 16 13 | yOfZ7Ilu5VcZ9svr 14 | 15 | 16 | -------------------------------------------------------------------------------- /Machine Learning(Andrew Ng)/machine-learning-ex8/ex8/visualizeFit.m: -------------------------------------------------------------------------------- 1 | function visualizeFit(X, mu, sigma2) 2 | %VISUALIZEFIT Visualize the dataset and its estimated distribution. 3 | % VISUALIZEFIT(X, p, mu, sigma2) This visualization shows you the 4 | % probability density function of the Gaussian distribution. Each example 5 | % has a location (x1, x2) that depends on its feature values. 6 | % 7 | 8 | [X1,X2] = meshgrid(0:.5:35); 9 | Z = multivariateGaussian([X1(:) X2(:)],mu,sigma2); 10 | Z = reshape(Z,size(X1)); 11 | 12 | plot(X(:, 1), X(:, 2),'bx'); 13 | hold on; 14 | % Do not plot if there are infinities 15 | if (sum(isinf(Z)) == 0) 16 | contour(X1, X2, Z, 10.^(-20:3:0)'); 17 | end 18 | hold off; 19 | 20 | end -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week1/C1_W1_Assignment_Logistic Regression.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week1/C1_W1_Assignment_Logistic Regression.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week2/C1_W2_Assignment_Naive Bayes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week2/C1_W2_Assignment_Naive Bayes.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week2/实验结果_false.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week2/实验结果_false.jpg -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week2/实验结果_false2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week2/实验结果_false2.jpg -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week3/C1_W3_Assignment_Word Vectors.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week3/C1_W3_Assignment_Word Vectors.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week4/C1_W4_Assignment_Naive Machine Translation and LSH.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Classification and Vector Spaces/week4/C1_W4_Assignment_Naive Machine Translation and LSH.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Probabilistic Models/week1/C2_W1_Assignment_Auto Correct.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Probabilistic Models/week1/C2_W1_Assignment_Auto Correct.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Probabilistic Models/week2/C2_W2_Assignment_Parts-of-Speech Tagging (POS).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Probabilistic Models/week2/C2_W2_Assignment_Parts-of-Speech Tagging (POS).pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Probabilistic Models/week3/C2_W3_Assignment_Auto-Complete.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Probabilistic Models/week3/C2_W3_Assignment_Auto-Complete.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Probabilistic Models/week4/C2_W4_Assignment_Word Embeddings.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Probabilistic Models/week4/C2_W4_Assignment_Word Embeddings.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Sequence Models/week1/C3_W1_Assignment_Sentiment with Deep Neural Networks.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Sequence Models/week1/C3_W1_Assignment_Sentiment with Deep Neural Networks.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Sequence Models/week2/C3_W2_Assignment_Deep N-grams.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Sequence Models/week2/C3_W2_Assignment_Deep N-grams.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Sequence Models/week3/C3_W3_Assignment_Named Entity Recognition (NER).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Sequence Models/week3/C3_W3_Assignment_Named Entity Recognition (NER).pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP with Sequence Models/week4/C3_W4_Assignment_Question duplicates.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP with Sequence Models/week4/C3_W4_Assignment_Question duplicates.pdf -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/NLP.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThreeSR/Coursera/37905f44cfb0cbef6d356a85c3b5cb1f03dbe837/Natural Language Processing Specialization in Coursera/NLP.jpg -------------------------------------------------------------------------------- /Natural Language Processing Specialization in Coursera/Readme.md: -------------------------------------------------------------------------------- 1 | # Welcome to Natural Language Processing Specialization in Coursera 2 | 3 | ## By learning this specialization, I hope you can lay a good foundation. 4 | 5 | ### Here are my certificates: 6 | 7 | #### [Natural Language Processing with Attention Models](https://coursera.org/share/8af6f10d462f9e0c387b65c57ac87d69) 8 | #### [Natural Language Processing with Classification and Vector Spaces](https://coursera.org/share/f715dbf6218c1021e70a30fc6b0b7ab0) 9 | #### [Natural Language Processing with Probabilistic Models](https://coursera.org/share/0e19c48bacb6b6c55d42013aff801808) 10 | #### [Natural Language Processing with Sequence Models](https://coursera.org/share/6f78a39814a09349a035d79b0833c97b) 11 | #### [Natural Language Processing Specialization](https://coursera.org/share/e9eb50f31019992c3873a52818aa289e) 12 | 13 | ![NLP](https://github.com/ThreeSR/Coursera/blob/main/Natural%20Language%20Processing%20Specialization%20in%20Coursera/NLP.jpg?raw=true) 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Coursera 2 | ## In this repository, I will share answers of some [Coursera](https://www.coursera.org/) courses. 3 | 4 | ![Coursera](https://digital.hbs.edu/platform-digit/wp-content/uploads/sites/2/2020/02/coursera-vector-logo-3-900x200.png) 5 | 6 | ### Currently, this repository contains the following courses: 7 | #### [Deep Learning](https://github.com/ThreeSR/Coursera/tree/main/Deep%20Learning(Andrew%20Ng)) [Andrew Ng](https://scholar.google.com/citations?user=mG4imMEAAAAJ&hl=en) 8 | #### [Machine Learning](https://github.com/ThreeSR/Coursera/tree/main/Machine%20Learning(Andrew%20Ng)) [Andrew Ng](https://scholar.google.com/citations?user=mG4imMEAAAAJ&hl=en) 9 | #### Tensorflow (deeplearning.ai) (Pending) 10 | #### [Natural Language Processing](https://github.com/ThreeSR/Coursera/tree/main/Natural%20Language%20Processing%20Specialization%20in%20Coursera) (deeplearning.ai) 11 | #### [Generative Adversarial Networks (GANs)](https://github.com/ThreeSR/Coursera/tree/main/Generative%20Adversarial%20Networks%20(GANs)%20Specialization%20in%20Coursera) (deeplearning.ai) 12 | #### [AI for Medicine](https://github.com/ThreeSR/Coursera/tree/main/AI%20for%20Medicine%20Specialization%20in%20Coursera) (deeplearning.ai) 13 | #### TensorFlow: Data and Deployment (deeplearning.ai) (Pending) 14 | #### C++ For C Programmers, Part A (University of California, Santa Cruz) (Pending) 15 | #### C++ For C Programmers, Part B (University of California, Santa Cruz) (Pending) 16 | #### Financial Markets (Yale University) (Pending) 17 | #### [Blockchain](https://github.com/ThreeSR/Coursera/tree/main/Blockchain%20Specialization%20in%20Coursera) (State University of New York at Buffalo) 18 | #### Object-Oriented Data Structures in C++ (University of Illinois at Urbana-Champaign) (Pending) 19 | 20 | ![Hi](https://media3.giphy.com/media/LOnt6uqjD9OexmQJRB/200w.webp) 21 | 29 | 30 | --------------------------------------------------------------------------------