This file contains 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
#include <bits/stdc++.h> | |
using namespace std; | |
vector<string> split_string(string); | |
/* | |
* Complete the waiter function below. | |
*/ |
This file contains 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 kappa_loss(p, y, n_classes=6, eps=1e-10): | |
""" | |
QWK loss function as described in https://arxiv.org/pdf/1612.00775.pdf | |
Arguments: | |
p: a tensor with probability predictions, [batch_size, n_classes], | |
y, a tensor with one-hot encoded class labels, [batch_size, n_classes] | |
Returns: | |
QWK loss | |
""" |
This file contains 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
class Solution { | |
public:; | |
int sumSquare(int n) { | |
int sum = 0; | |
while(n !=0){ | |
sum += (n%10) * (n%10); | |
n = n/10; | |
} | |
return sum; |
This file contains 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
// Every number > 9 on sum of squared expansion will reduce to number < 9 | |
// In [0-9], there are only two cases when number < 9 and it is happy number i.e 1 and 7 | |
class Solution { | |
public:; | |
int sumSquare(int n) { | |
int sum = 0; | |
while(n !=0){ | |
sum += (n%10) * (n%10); |
This file contains 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
func downloadMovieLensDatasetIfNotPresent() -> String{ | |
let localURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) | |
let dataFolder = DatasetUtilities.downloadResource( | |
filename: "ml-25m", | |
fileExtension: "zip", | |
remoteRoot: URL(string: "http://files.grouplens.org/datasets/movielens/")!, | |
localStorageDirectory: localURL.appendingPathComponent("data/", isDirectory: true) | |
) | |
return try! String(contentsOf: dataFolder.appendingPathComponent("ratings.csv"), encoding: .utf8) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.