一:逻辑回归(Logistic Regression)

  背景:假设你是一所大学招生办的领导,你依据学生的成绩,给与他入学的资格。现在有这样一组以前的数据集ex2data1.txt,第一列表示第一次测验的分数,第二列表示第二次测验的分数,第三列1表示允许入学,0表示不允许入学。现在依据这些数据集,设计出一个模型,作为以后的入学标准。

  

  我们通过可视化这些数据集,发现其与某条直线方程有关,而结果又只有两类,故我们接下来使用逻辑回归去拟合该数据集。

  

  1,回归方程的脚本ex2.m:

  1. %% Machine Learning Online Class - Exercise : Logistic Regression
  2. %
  3. % Instructions
  4. % ------------
  5. %
  6. % This file contains code that helps you get started on the logistic
  7. % regression exercise. You will need to complete the following functions
  8. % in this exericse:
  9. %
  10. % sigmoid.m
  11. % costFunction.m
  12. % predict.m
  13. % costFunctionReg.m
  14. %
  15. % For this exercise, you will not need to change any code in this file,
  16. % or any other files other than those mentioned above.
  17. %
  18.  
  19. %% Initialization
  20. clear ; close all; clc
  21.  
  22. %% Load Data
  23. % The first two columns contains the exam scores and the third column
  24. % contains the label.
  25.  
  26. data = load('ex2data1.txt');
  27. X = data(:, [, ]); y = data(:, );
  28.  
  29. %% ==================== Part : Plotting ====================
  30. % We start the exercise by first plotting the data to understand the
  31. % the problem we are working with.
  32.  
  33. fprintf(['Plotting data with + indicating (y = 1) examples and o ' ...
  34. 'indicating (y = 0) examples.\n']);
  35.  
  36. plotData(X, y);
  37.  
  38. % Put some labels
  39. hold on;
  40. % Labels and Legend
  41. xlabel('Exam 1 score')
  42. ylabel('Exam 2 score')
  43.  
  44. % Specified in plot order
  45. legend('Admitted', 'Not admitted')
  46. hold off;
  47.  
  48. fprintf('\nProgram paused. Press enter to continue.\n');
  49. pause;
  50.  
  51. %% ============ Part : Compute Cost and Gradient ============
  52. % In this part of the exercise, you will implement the cost and gradient
  53. % for logistic regression. You neeed to complete the code in
  54. % costFunction.m
  55.  
  56. % Setup the data matrix appropriately, and add ones for the intercept term
  57. [m, n] = size(X);
  58.  
  59. % Add intercept term to x and X_test
  60. X = [ones(m, ) X];
  61.  
  62. % Initialize fitting parameters
  63. initial_theta = zeros(n + , );
  64.  
  65. % Compute and display initial cost and gradient
  66. [cost, grad] = costFunction(initial_theta, X, y);
  67.  
  68. fprintf('Cost at initial theta (zeros): %f\n', cost);
  69. fprintf('Expected cost (approx): 0.693\n');
  70. fprintf('Gradient at initial theta (zeros): \n');
  71. fprintf(' %f \n', grad);
  72. fprintf('Expected gradients (approx):\n -0.1000\n -12.0092\n -11.2628\n');
  73.  
  74. % Compute and display cost and gradient with non-zero theta
  75. test_theta = [-; 0.2; 0.2];
  76. [cost, grad] = costFunction(test_theta, X, y);
  77.  
  78. fprintf('\nCost at test theta: %f\n', cost);
  79. fprintf('Expected cost (approx): 0.218\n');
  80. fprintf('Gradient at test theta: \n');
  81. fprintf(' %f \n', grad);
  82. fprintf('Expected gradients (approx):\n 0.043\n 2.566\n 2.647\n');
  83.  
  84. fprintf('\nProgram paused. Press enter to continue.\n');
  85. pause;
  86.  
  87. %% ============= Part : Optimizing using fminunc =============
  88. % In this exercise, you will use a built-in function (fminunc) to find the
  89. % optimal parameters theta.
  90.  
  91. % Set options for fminunc
  92. options = optimset('GradObj', 'on', 'MaxIter', );
  93.  
  94. % Run fminunc to obtain the optimal theta
  95. % This function will return theta and the cost
  96. [theta, cost] = ...
  97. fminunc(@(t)(costFunction(t, X, y)), initial_theta, options);
  98.  
  99. % Print theta to screen
  100. fprintf('Cost at theta found by fminunc: %f\n', cost);
  101. fprintf('Expected cost (approx): 0.203\n');
  102. fprintf('theta: \n');
  103. fprintf(' %f \n', theta);
  104. fprintf('Expected theta (approx):\n');
  105. fprintf(' -25.161\n 0.206\n 0.201\n');
  106.  
  107. % Plot Boundary
  108. plotDecisionBoundary(theta, X, y);
  109.  
  110. % Put some labels
  111. hold on;
  112. % Labels and Legend
  113. xlabel('Exam 1 score')
  114. ylabel('Exam 2 score')
  115.  
  116. % Specified in plot order
  117. legend('Admitted', 'Not admitted')
  118. hold off;
  119.  
  120. fprintf('\nProgram paused. Press enter to continue.\n');
  121. pause;
  122.  
  123. %% ============== Part : Predict and Accuracies ==============
  124. % After learning the parameters, you'll like to use it to predict the outcomes
  125. % on unseen data. In this part, you will use the logistic regression model
  126. % to predict the probability that a student with score on exam and
  127. % score on exam will be admitted.
  128. %
  129. % Furthermore, you will compute the training and test set accuracies of
  130. % our model.
  131. %
  132. % Your task is to complete the code in predict.m
  133.  
  134. % Predict probability for a student with score on exam
  135. % and score on exam
  136.  
  137. prob = sigmoid([ ] * theta);
  138. fprintf(['For a student with scores 45 and 85, we predict an admission ' ...
  139. 'probability of %f\n'], prob);
  140. fprintf('Expected value: 0.775 +/- 0.002\n\n');
  141.  
  142. % Compute accuracy on our training set
  143. p = predict(theta, X);
  144.  
  145. fprintf('Train Accuracy: %f\n', mean(double(p == y)) * );
  146. fprintf('Expected accuracy (approx): 89.0\n');
  147. fprintf('\n');

ex2.m

  

  2,可视化数据plotData.m:

  1. function plotData(X, y)
  2. %PLOTDATA Plots the data points X and y into a new figure
  3. % PLOTDATA(x,y) plots the data points with + for the positive examples
  4. % and o for the negative examples. X is assumed to be a Mx2 matrix.
  5.  
  6. % Create New Figure
  7. figure; hold on;
  8.  
  9. % ====================== YOUR CODE HERE ======================
  10. % Instructions: Plot the positive and negative examples on a
  11. % 2D plot, using the option 'k+' for the positive
  12. % examples and 'ko' for the negative examples.
  13. %
  14.  
  15. pos=find(y==);
  16. neg=find(y==);
  17. plot(X(pos,),X(pos,),'k+','LineWidth',,'MarkerSize',);
  18. plot(X(neg,),X(neg,),'ko','MarkerFaceColor','y','MarkerSize',);
  19.  
  20. % =========================================================================
  21.  
  22. hold off;
  23.  
  24. end

plotData.m

  

  3,逻辑回归的逻辑函数(Sigmoid Function/Logistic Function):

  $h_{\theta}(x)=g(\theta^{T}x)$ :表示在输入为$x$,预测为$y=1$的概率

  $g(z)=\frac{1}{1+e^{-z}}$  

  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. g=./(+exp(-z));
  13.  
  14. % =============================================================
  15.  
  16. end

sigmoid.m

  4,逻辑回归的代价函数:

  $J(\theta)=-\frac{1}{m}\sum_{i=1}^{m}[y^{(i)}log(h_\theta(x^{(i)}))+(1-y^{(i)})log(1-h_{\theta}(x^{(i)}))]$

  1. function [J, grad] = costFunction(theta, X, y)
  2. %COSTFUNCTION Compute cost and gradient for logistic regression
  3. % J = COSTFUNCTION(theta, X, y) computes the cost of using theta as the
  4. % parameter for logistic regression and the gradient of the cost
  5. % w.r.t. to the parameters.
  6.  
  7. % Initialize some useful values
  8. m = length(y); % number of training examples
  9.  
  10. % You need to return the following variables correctly
  11. J = ;
  12. grad = zeros(size(theta));
  13.  
  14. % ====================== YOUR CODE HERE ======================
  15. % Instructions: Compute the cost of a particular choice of theta.
  16. % You should set J to the cost.
  17. % Compute the partial derivatives and set grad to the partial
  18. % derivatives of the cost w.r.t. each parameter in theta
  19. %
  20. % Note: grad should have the same dimensions as theta
  21. %
  22.  
  23. h=sigmoid(X*theta); %求hθ(x)
  24. J=-sum(y.*log(h)+(-y).*log(-h))/m; %代价函数
  25.  
  26. grad=(X')*(h-y)./m; %梯度下降,没有学习速率α,之后给我们调用内置函数fminunc使用
  27.  
  28. ## h=sigmoid(X*theta);
  29. ##J=sum(-y'*log(h)-(1-y)'*log(-h))/m;
  30. ##grad=((h-y)'*X)/m;
  31.  
  32. % =============================================================
  33.  
  34. end

costFunction.m

  5,带学习速率$\alpha$的梯度下降:

  $\theta_j:=\theta_j-\frac{\alpha}{m }\sum_{i=1}^{m}[(h_\theta(x^{(i)})-y^{(i)})x^{(i)}_j]$

  

  不带学习速率$\alpha$的梯度下降(给之后fminunc作为梯度下降使用):

  $\frac{\partial J(\theta)}{\partial \theta_j}=\frac{1}{m}\sum_{i=1}^{m}[(h_\theta(x^{(i)})-y^{(i)})x^{(i)}_j]$

  使用内置fminunc函数来拟合参数$\theta$,之前我们是使用梯度下降来拟合参数$\theta$的,在这同样也能使用,不过我们这里使用内置fminunc函数来去拟合,它会自动选择学习速率$\alpha$,不需要我们手工选择,我们只需要给定一个迭代次数,一个写好的代价函数,初始化$\theta$,最后它会为我们找到最优的$\theta$,它像可以加强版的梯度下降法。

  1. options = optimset('GradObj', 'on', 'MaxIter', );
  2. [theta, cost] = ...
  3. fminunc(@(t)(costFunction(t, X, y)), initial_theta, options);//自己写好的costFunction函数

  

  6,根据拟合好的参数$\theta$,预测数据,例如我们想预测某学生第一次分数为45,第二次分数为85,该学生能入学的概率为:

  1. prob = sigmoid([ ] * theta); %入学的概率

  预测样本X,我们可以看到预测的准确率为89%。

  1. function p = predict(theta, X)
  2. %PREDICT Predict whether the label is or 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, ); % Number of training examples
  8.  
  9. % You need to return the following variables correctly
  10. p = zeros(m, );
  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 's and 1's
  16. %
  17.  
  18. %第一种
  19. for i=:m
  20. p(i,)=sigmoid(X(i,:)*theta)>=0.5; %预测每一个样本的结果,大于0.5为正向类
  21. end;
  22.  
  23. %第二种
  24. %
  25. ## ans=sigmoid(X*theta);
  26. ## for i=:m
  27. ## if(ans(i,)>=0.5)
  28. ## p(i,)=;
  29. ## else
  30. ## p(i,)=;
  31. ## end
  32.  
  33. % =========================================================================
  34.  
  35. end

predict.m

二:正则化逻辑回归(Regularized logistic regression):

  背景:假如你是某所工厂的管理员,该工厂生产芯片,每片芯片要经过两次测试后,达到标准方可通过,现在有一组以前的数据集ex2data2.txt,第一列为第一次测试的结果,第二列为第二次测试的结果,第三列1表示该芯片合格,0表示不合格。现在要你通过这些数据,拟合出一个模型,这个模型将作为以后判断芯片是否合格的标准。

  

  我们通过可视化这些数据集,发现其与某条复杂的曲线方程有关,而数据集只有两个特征$x_1$和$x_2$,显然是拟合不出曲线,那么我们可以通过原本的两个特征创造出更多的特征,将原本的特征映射为6次幂,这样我们就得到了28维的特征向量。当特征多了的话,很可能会出现过拟合,显然这不是我们想要的(即是它能很好的拟合原训练集,但预测新样本的能力会很低)。

构造更多的特征:

  1. function out = mapFeature(X1, X2)
  2. % MAPFEATURE Feature mapping function to polynomial features
  3. %
  4. % MAPFEATURE(X1, X2) maps the two input features
  5. % to quadratic features used in the regularization exercise.
  6. %
  7. % Returns a new feature array with more features, comprising of
  8. % X1, X2, X1.^, X2.^, X1*X2, X1*X2.^, etc..
  9. %
  10. % Inputs X1, X2 must be the same size
  11. %
  12.  
  13. degree = ;
  14. out = ones(size(X1(:,)));
  15. for i = :degree
  16. for j = :i
  17. out(:, end+) = (X1.^(i-j)).*(X2.^j);
  18. end
  19. end
  20.  
  21. end

mapFeature.m

所以这时我们使用正则化(Regularization)来解决过拟合的问题。

  1,正则化回归的脚本ex2.m: 

  1. %% Machine Learning Online Class - Exercise : Logistic Regression
  2. %
  3. % Instructions
  4. % ------------
  5. %
  6. % This file contains code that helps you get started on the second part
  7. % of the exercise which covers regularization with logistic regression.
  8. %
  9. % You will need to complete the following functions in this exericse:
  10. %
  11. % sigmoid.m
  12. % costFunction.m
  13. % predict.m
  14. % costFunctionReg.m
  15. %
  16. % For this exercise, you will not need to change any code in this file,
  17. % or any other files other than those mentioned above.
  18. %
  19.  
  20. %% Initialization
  21. clear ; close all; clc
  22.  
  23. %% Load Data
  24. % The first two columns contains the X values and the third column
  25. % contains the label (y).
  26.  
  27. data = load('ex2data2.txt');
  28. X = data(:, [, ]); y = data(:, );
  29.  
  30. plotData(X, y);
  31.  
  32. % Put some labels
  33. hold on;
  34.  
  35. % Labels and Legend
  36. xlabel('Microchip Test 1')
  37. ylabel('Microchip Test 2')
  38.  
  39. % Specified in plot order
  40. legend('y = 1', 'y = 0')
  41. hold off;
  42.  
  43. %% =========== Part : Regularized Logistic Regression ============
  44. % In this part, you are given a dataset with data points that are not
  45. % linearly separable. However, you would still like to use logistic
  46. % regression to classify the data points.
  47. %
  48. % To do so, you introduce more features to use -- in particular, you add
  49. % polynomial features to our data matrix (similar to polynomial
  50. % regression).
  51. %
  52.  
  53. % Add Polynomial Features
  54.  
  55. % Note that mapFeature also adds a column of ones for us, so the intercept
  56. % term is handled
  57. X = mapFeature(X(:,), X(:,)); %c从原来的二维变成了28(+1截距项)维,m*
  58.  
  59. % Initialize fitting parameters
  60. initial_theta = zeros(size(X, ), );
  61.  
  62. % Set regularization parameter lambda to
  63. lambda = ;
  64.  
  65. % Compute and display initial cost and gradient for regularized logistic
  66. % regression
  67. [cost, grad] = costFunctionReg(initial_theta, X, y, lambda);
  68.  
  69. fprintf('Cost at initial theta (zeros): %f\n', cost);
  70. fprintf('Expected cost (approx): 0.693\n');
  71. fprintf('Gradient at initial theta (zeros) - first five values only:\n');
  72. fprintf(' %f \n', grad(:));
  73. fprintf('Expected gradients (approx) - first five values only:\n');
  74. fprintf(' 0.0085\n 0.0188\n 0.0001\n 0.0503\n 0.0115\n');
  75.  
  76. fprintf('\nProgram paused. Press enter to continue.\n');
  77. pause;
  78.  
  79. % Compute and display cost and gradient
  80. % with all-ones theta and lambda =
  81. test_theta = ones(size(X,),);
  82. [cost, grad] = costFunctionReg(test_theta, X, y, );
  83.  
  84. fprintf('\nCost at test theta (with lambda = 10): %f\n', cost);
  85. fprintf('Expected cost (approx): 3.16\n');
  86. fprintf('Gradient at test theta - first five values only:\n');
  87. fprintf(' %f \n', grad(:));
  88. fprintf('Expected gradients (approx) - first five values only:\n');
  89. fprintf(' 0.3460\n 0.1614\n 0.1948\n 0.2269\n 0.0922\n');
  90.  
  91. fprintf('\nProgram paused. Press enter to continue.\n');
  92. pause;
  93.  
  94. %% ============= Part : Regularization and Accuracies =============
  95. % Optional Exercise:
  96. % In this part, you will get to try different values of lambda and
  97. % see how regularization affects the decision coundart
  98. %
  99. % Try the following values of lambda (, , , ).
  100. %
  101. % How does the decision boundary change when you vary lambda? How does
  102. % the training set accuracy vary?
  103. %
  104.  
  105. % Initialize fitting parameters
  106. initial_theta = zeros(size(X, ), );
  107.  
  108. % Set regularization parameter lambda to (you should vary this)
  109. lambda = ;
  110.  
  111. % Set Options
  112. options = optimset('GradObj', 'on', 'MaxIter', );
  113.  
  114. % Optimize
  115. [theta, J, exit_flag] = ...
  116. fminunc(@(t)(costFunctionReg(t, X, y, lambda)), initial_theta, options);
  117.  
  118. % Plot Boundary
  119. plotDecisionBoundary(theta, X, y);
  120. hold on;
  121. title(sprintf('lambda = %g', lambda))
  122.  
  123. % Labels and Legend
  124. xlabel('Microchip Test 1')
  125. ylabel('Microchip Test 2')
  126.  
  127. legend('y = 1', 'y = 0', 'Decision boundary')
  128. hold off;
  129.  
  130. % Compute accuracy on our training set
  131. p = predict(theta, X);
  132.  
  133. fprintf('Train Accuracy: %f\n', mean(double(p == y)) * );
  134. fprintf('Expected accuracy (with lambda = 1): 83.1 (approx)\n');

ex2_reg.m

  2,正则化逻辑回归代价函数(忽略偏差项$\theta_0$的正则化):

  $J(\theta)=-\frac{1}{m}\sum_{i=1}^{m}[y^{(i)}log(h_\theta(x^{(i)}))+(1-y^{(i)})log(1-h_{\theta}(x^{(i)}))]+\frac{\lambda }{2m}\sum_{j=1}^{n}\theta_j^{2}$

  

  3,梯度下降:

  带学习速率:

    $\theta_0:=\theta_0-\alpha \frac{1}{m }\sum_{i=1}^{m}[(h_\theta(x^{(i)})-y^{(i)})x^{(i)}_0]$   for $j=0$

    $\theta_j:=\theta_j-\alpha (\frac{1}{m }\sum_{i=1}^{m}[(h_\theta(x^{(i)})-y^{(i)})x^{(i)}_j]+\frac{\lambda }{m}\theta_j)$  for $j\geq 1$

  不带学习速率(给之后fminunc作为梯度下降使用):

    $\frac{\partial J(\theta)}{\partial \theta_0}=\frac{1}{m}\sum_{i=1}^{m}[(h_\theta(x^{(i)})-y^{(i)})x^{(i)}_0]$  for $j=0$

    $\frac{\partial J(\theta)}{\partial \theta_j}=(\frac{1}{m}\sum_{i=1}^{m}[(h_\theta(x^{(i)})-y^{(i)})x^{(i)}_j])+\frac{\lambda }{m}\theta_j $ for $j\geq 1$

  

  1. function [J, grad] = costFunctionReg(theta, X, y, lambda)
  2. %COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization
  3. % J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using
  4. % theta as the parameter for regularized logistic regression and the
  5. % gradient of the cost w.r.t. to the parameters.
  6.  
  7. % Initialize some useful values
  8. m = length(y); % number of training examples
  9.  
  10. % You need to return the following variables correctly
  11. J = ;
  12. grad = zeros(size(theta));
  13.  
  14. % ====================== YOUR CODE HERE ======================
  15. % Instructions: Compute the cost of a particular choice of theta.
  16. % You should set J to the cost.
  17. % Compute the partial derivatives and set grad to the partial
  18. % derivatives of the cost w.r.t. each parameter in theta
  19.  
  20. h=sigmoid(X*theta);
  21. n=size(X,);
  22. J=(-(y')*log(h)-(1-y)'*log(-h))/m+(lambda/(*m))*sum(theta([:n],:).^); %忽略偏差项θ()的影响
  23.  
  24. grad(,)=((X(:,)')*(h-y))/m; %梯度下降
  25. grad([:n],:)=(X(:,[:n])')*(h-y)./m+(theta([2:n],:)).*(lambda/m);
  26.  
  27. ##h=sigmoid(X*theta);
  28. ##theta(,)=;
  29. ##J=sum(-y'*log(h)-(1-y)'*log(-h))/m+lambda//m*sum(power(theta,));
  30. ##grad=((h-y)'*X)/m+lambda/m*theta';
  31. % =============================================================
  32.  
  33. end

costFunctionReg.m

  我们可以选择不同的$\lambda$大小去拟合数据集并可视化,选择一个较优的$lambda$。

  4,预测方法跟逻辑回归差不多,只是现在加入要预测第一次分数为45,第二次分数为80时,要先将这两个特征放到mapFeature函数构造。

我的标签:做个有情怀的程序员。

Andrew Ng机器学习 二: Logistic Regression的更多相关文章

  1. (原创)Stanford Machine Learning (by Andrew NG) --- (week 3) Logistic Regression & Regularization

    coursera上面Andrew NG的Machine learning课程地址为:https://www.coursera.org/course/ml 我曾经使用Logistic Regressio ...

  2. Andrew Ng机器学习课程笔记(二)之逻辑回归

    Andrew Ng机器学习课程笔记(二)之逻辑回归 版权声明:本文为博主原创文章,转载请指明转载地址 http://www.cnblogs.com/fydeblog/p/7364636.html 前言 ...

  3. Andrew Ng机器学习课程6

    Andrew Ng机器学习课程6 说明 在前面尾随者台大机器学习基石课程和机器学习技法课程的设置,对机器学习所涉及到的大部分的知识有了一个较为全面的了解,可是对于没有动手敲代码并加以使用的情况,基本上 ...

  4. Andrew Ng机器学习课程10

    Andrew Ng机器学习课程10 a example 如果hypothesis set中的hypothesis是由d个real number决定的,那么用64位的计算机数据表示的话,那么模型的个数一 ...

  5. Andrew Ng机器学习课程笔记(四)之神经网络

    Andrew Ng机器学习课程笔记(四)之神经网络 版权声明:本文为博主原创文章,转载请指明转载地址 http://www.cnblogs.com/fydeblog/p/7365730.html 前言 ...

  6. Andrew Ng机器学习课程笔记--week1(机器学习介绍及线性回归)

    title: Andrew Ng机器学习课程笔记--week1(机器学习介绍及线性回归) tags: 机器学习, 学习笔记 grammar_cjkRuby: true --- 之前看过一遍,但是总是模 ...

  7. Andrew Ng机器学习课程笔记(五)之应用机器学习的建议

    Andrew Ng机器学习课程笔记(五)之 应用机器学习的建议 版权声明:本文为博主原创文章,转载请指明转载地址 http://www.cnblogs.com/fydeblog/p/7368472.h ...

  8. Andrew Ng机器学习课程笔记--汇总

    笔记总结,各章节主要内容已总结在标题之中 Andrew Ng机器学习课程笔记–week1(机器学习简介&线性回归模型) Andrew Ng机器学习课程笔记--week2(多元线性回归& ...

  9. Andrew Ng机器学习课程笔记(六)之 机器学习系统的设计

    Andrew Ng机器学习课程笔记(六)之 机器学习系统的设计 版权声明:本文为博主原创文章,转载请指明转载地址 http://www.cnblogs.com/fydeblog/p/7392408.h ...

随机推荐

  1. net ads join 和net rpc join命令的区别

    要将主机加入Active Directory(AD),请输入: #net ads加入-U administrator 输入管理员密码:Passw0rd 使用短域名 - SAMDOM 加入'M1'到dn ...

  2. [LeetCode] 316. Remove Duplicate Letters 移除重复字母

    Given a string which contains only lowercase letters, remove duplicate letters so that every letter ...

  3. [LeetCode] 489. Robot Room Cleaner 扫地机器人

    Given a robot cleaner in a room modeled as a grid. Each cell in the grid can be empty or blocked. Th ...

  4. python的进修之路

    PYTHON目录篇 本篇主要在个人学习python中的一些总结性的总线,包括python的基础,python的基础进阶,除了帮助和我一样学习python的同学,也是对自己的一种要求! python基础 ...

  5. 常用Tables控件介绍(二)

    初始化:1.使用现有表单创建数据表格,定义在HTML中的字段和数据 2.使用现有的table创建数据表格,定义在HTML中的字段 3.使用JS创建数据库表格 一.初始化后,根据单元格内的值,修改显示内 ...

  6. DFS解决八皇后问题

    2019-07-29 16:49:15 #include <bits/stdc++.h> using namespace std; ][]; int tot; int check(int ...

  7. mongdb基本使用

    mongodb创建用户,设置密码 参考:https://www.jianshu.com/p/237a0c5ad9fa MongoDB内置的数据库角色有: 1. 数据库用户角色:read.readWri ...

  8. Spring中ApplicationContextAware的作用

    ApplicationContextAware 通过它Spring容器会自动把上下文环境对象调用ApplicationContextAware接口中的setApplicationContext方法. ...

  9. Windows server 2012 R2下安装sharepoint2013

    • 安装windows server 2012 R2 系统,配置IP.系统打补丁,修改主机名.加域后重启.• 安装WEB服务器,勾选windows身份验证 • 安装应用程序服务器 • 安装.NET F ...

  10. <P>标签是什么?怎么用!

    <P>标签它是一个段落标签,它和<br>标签不一样.会自行起一行段落,并且可以作为一个盒子来使用.可以单独定义它. 比如下图: <p>这个就是一个段落</p& ...