Skip to content

Instantly share code, notes, and snippets.

View SumanSudhir's full-sized avatar
🏠
Working from home

Sudhir Kumar Suman SumanSudhir

🏠
Working from home
View GitHub Profile
@SumanSudhir
SumanSudhir / waiter.cpp
Created September 19, 2020 18:12
hackerrank
#include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
/*
* Complete the waiter function below.
*/
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
"""
class Solution {
public:;
int sumSquare(int n) {
int sum = 0;
while(n !=0){
sum += (n%10) * (n%10);
n = n/10;
}
return sum;
// 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);
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.