Given the set of commands in matlab. >>a-(1 -2; 2 -3; 1 -1]; %. first command >>
ID: 3697068 • Letter: G
Question
Given the set of commands in matlab. >>a-(1 -2; 2 -3; 1 -1]; %. first command >> A(1. 1:2)' % second command >>B=A*% third command >> B(2.1)^2 %fourth command What will display on the screen after the second command ? What will display on the screen after the third command ? What will display on the screen after the third command ? In Matlab, show the script to compute the following terms for any x and y already assigned, y log_10(x^3)/x - y >>?? (1 - x/5)^-1 >>??Explanation / Answer
clear all; clc; close all; %% Load Training Data t = cputime; fprintf('Loading and Visualizing Data') load('data.mat'); % Randomly select 100 data points to display sel = randperm(size(X, 1)); sel = sel(1:100); displayData(X(sel, :)); % function taken from Andrew Ng machine learning course fprintf('...done '); %% Split data into training and testing fprintf('Splitting Data into training and testing sets'); [XTrain XTest yTrain yTest] = splitData(X, y); fprintf('...done '); %% Initialize parameters fprintf('Initializing parameters'); m = size(X, 1); % number of examples lambda = 0.1; % regularization parameter numLabels = size(unique(y),1); % number of labels fprintf('...done '); %% Training Logistic Regression classifier fprintf('Training One-vs-All Logistic Regression'); theta = LRClassifier(XTrain, yTrain, numLabels, lambda); fprintf('...done '); %% Predict numbers prediction = predict(theta, XTest); %% Calculate Accuracy over the training data fprintf(' Test Set Accuracy: %f ', mean(double(prediction == yTest)) * 100); fprintf('Program executed in %f seconds or %f minutes ', cputime-t, (cputime-t)/60);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.