This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "@context": { ... }, | |
| "obi:validation": [ | |
| { | |
| "obi:validatesType": "obi:extensions/SecuredExtendedTranscript", | |
| "obi:validationSchema": "https://openbadgespec.org/extensions/securedExtendedTranscript/schema.json" | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "@context": "https://purl.imsglobal.org/ctx/extended-transcript/v1p0", | |
| "obi:validation": [ | |
| { | |
| "obi:validatesType": "obi:extensions/ExtendedTranscript", | |
| "obi:validationSchema": "https://purl.imsglobal.org/ctx/extended-transcript/v1p0/schema.json" | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Given: | |
| % X ϵ R^m,n | |
| % y ϵ R^m,1 | |
| % - - - - - - - - - - - - - - - | |
| % X ϵ R^m,n | |
| % theta ϵ R^n,1 | |
| % - - - - - - - - - - - - - - - | |
| function h = calcH(X, theta) | |
| h = X * theta; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % | |
| % Assume network input layer of size s1, | |
| % one hidden layer of size s2, | |
| % and an output layer of size s3. | |
| % | |
| % Note a bias unit is added to input and hidden layers. | |
| % | |
| % Theta1 and Theta2 are pre-calculated weights. | |
| % (This example just performs forward propogation.) | |
| % |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [theta, J] = runGradientDescent(x, y, theta, alpha, lambda, iters) | |
| J = 0; | |
| m = length(y); | |
| for i=0:iters-1 | |
| h = calcH(theta, x); | |
| % todo: theta(0) should not include regularization: (lambda * theta) / m | |
| theta = theta - alpha * ( (1 / m) * (h - y) * x' + (lambda * theta) / m ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % H(theta) = theta1 + x1 * theta2 + x2 * theta3 | |
| global x = ...; % load R^n,m data | |
| global y = ...; % load R^1,m outcomes | |
| global n = length(x(:,1)); | |
| global m = length(x(1,:)); | |
| function cost = cost(h, y) | |
| costs = -y .* log(h) - (1 - y) .* log(1 - h); | |
| cost = sum(costs) / length(h); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % | |
| % x is R^n,m | |
| % y is R^1,m | |
| % theta is R^1,n | |
| % alpha is float (e.g., 0.01) | |
| % alpha is int (e.g., 10000) | |
| % | |
| function [theta, J] = runGradientDescent(x, y, theta, alpha, iters) | |
| J = 0; | |
| for i=0:iters-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [theta, J] = runGradientDescent(x, y, theta, alpha, iters) | |
| J = 0; | |
| for i=0:iters-1 | |
| h = calcH(theta, x); | |
| errors = h - y; | |
| matrix = errors * x'; | |
| theta = theta - ( alpha / length(y) ) * matrix; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % - - - - - - - - - - - - - | |
| % h is R^1,m | |
| % y is R^1,m | |
| % - - - - - - - - - - - - - | |
| function cost = calcCost(h, y) | |
| costs = -y .* log(h) - (1 - y) .* log(1 - h); | |
| cost = sum(costs) / length(h); | |
| endfunction | |
| % - - - - - - - - - - - - - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % - - - - - - - - - - - - - | |
| % hVal, yVal are scalar values | |
| % yVal ∈ { 0, 1 } | |
| % - - - - - - - - - - - - - | |
| function cost = calcCostTerm(hVal, yVal) | |
| % equivalent to: | |
| % if yVal == 1, sum -= log(hVal); | |
| % elseif yVal == 0, sum -= log(1 - hVal); | |
| cost = -yVal * log(hVal) - (1 - yVal) * log(1 - hVal); | |
| endfunction |