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
| var observable = Rx.Observable.create(function(observer){ | |
| observer.next("Hello") | |
| observer.next("world") | |
| observer.complete() | |
| }) | |
| observable.subscribe({ | |
| next: data => console.log(`${data}`), | |
| complete: () => console.log('done'), | |
| error: err => console.log('error'), |
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
| /* ----------------------------------- | |
| * WARNING: | |
| * ----------------------------------- | |
| * Your code may fail to compile | |
| * because it contains public class | |
| * declarations. | |
| * To fix this, please remove the | |
| * "public" keyword from your class | |
| * declarations. | |
| */ |
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
| import torch #import torch | |
| X = torch.tensor(1.0) | |
| Y = torch.tensor([1.0,2.0]) | |
| #Creates two tensor objects | |
| #Alternatively we can also create a tensor from data like this | |
| Z = torch.tensor([[1.0,2.0,3.0], | |
| [2.0,3.0,4.0], | |
| [3.0,4.0,5.0]]) | |
| #We can also look at the shape of each tensor as follows |
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
| import torch | |
| #Creates two tensor objects | |
| #Where X is a simple 1 Dimentional Tensor | |
| #Y is a vector | |
| X = torch.tensor(1.0) | |
| Y = torch.tensor([1.0,2.0]) | |
| #Alternatively we can also create a tensor from data like this | |
| Z = torch.tensor([[1.0,2.0,3.0], | |
| [2.0,3.0,4.0], | |
| [3.0,4.0,5.0]]) |
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
| { | |
| "author": "Vigneash Sundararajan", | |
| "name": "sample", | |
| "version":"0.0.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
| def maxCount(arr): | |
| prevMax = 0 | |
| currMax = 0 | |
| for ar in arr: | |
| temp = currMax | |
| currMax = max(prevMax+ar, currMax) | |
| prevMax = temp | |
| return currMax |
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
| def lcs(X,Y, m, n): | |
| if m < 0 or n < 0: | |
| return 0 | |
| elif X[m] == Y[n]: | |
| return 1 + lcs(X,Y, m-1,n-1) | |
| else: | |
| return max(lcs(X,Y,m-1,n),lcs(X,Y,m,n-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
| def lis_dp(X): | |
| if not X: | |
| return 0 | |
| memo = [1] * len(X) | |
| for i in range(1,len(X)): | |
| for j in range(i): | |
| if X[j] < X[i]: | |
| memo[i] = max(memo[i],memo[j]+1) | |
| return max(memo) |
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
| import numpy as np | |
| input1 = [0,0,1,1] | |
| input2 = [1,0,1,0] | |
| truth = [0,0,1,0] | |
| weight1 = 1 | |
| weight2 = 1 | |
| bias = -2 | |
| def perceptron(input1, input2): |
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
| import numpy as np | |
| input1 = [0,0,1,1] | |
| input2 = [1,0,1,0] | |
| truth = [0,1,0,1] | |
| weight1 = 0 | |
| weight2 = -1 | |
| bias = 0 | |
| def perceptron(input1, input2): |
OlderNewer