npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aksquare.js

v1.0.1

Published

"Aksquare.js is JavaScript library for building and training deep learning models."

Downloads

5

Readme

aksquare.js

A deep learning library built using javascript to build and train machine learning models in the browsers.

Install

npm install aksquare.js --save

Getting Started

via Script tag Add the following code to an HTML file:

<html>
  <head>
  <script>https://cdn.jsdelivr.net/npm/[email protected]/aksquare/aksquare.min.js</script>

<script>     
let text = "The king is a man who rules over a nation, he always have a woman beside him called the queen.
text_lower = text.toLocaleLowerCase()

text_list = text_lower.split("\n")

var stopwords = ["a","in","when","the","of","is","who"]


let [word_list, all_text] = gen_word(5,text_list);


let unique_dict = unique_word(all_text)

let n_words = obj_len(unique_dict);

console.log(n_words);


let [data, label] = create_data(word_list)


let embed_dim = 50;
let model = new aksquare.Sequential([
        new aksquare.Linear(n_words,embed_dim),
        new aksquare.Linear(embed_dim,n_words),
        new aksquare.Softmax()
]);

let optim = new aksquare.OptimSGD(model,lr=0.001);


epoch = 50
for(let i=0; i< epoch; i++){

    let total_loss = 0;
    for(let j=0; j < data.length; j++){

        let x_data = data[j]
        let y_data = label[j]

        let x = new aksquare.Tensor(1,n_words, false);
        x.setFrom(x_data)

        model.forward(x)

        // console.log(-Math.log(model.out.out[y_data-1]))
        let loss = new aksquare.Loss(y_data-1,model)

        // console.log(loss.out);
        total_loss += loss.out

        loss.backward()

        optim.step();

        optim.grad_zero()

    }

    console.log(`for epoch ${i} Loss is ${total_loss/data.length}`)
}

//get embedding weight

let embed_weight = get_weight(model.models[0].W)
console.log(embed_weight[0].length)

    </script> 
  </head>
 
  <body>
  </body>
</html>

Via NPM

Install aksquare.js in your project using yarn or npm

import * as aksquare from 'aksquare.js'

let embed_dim = 50;
let model = new aksquare.Sequential([
        new aksquare.Linear(n_words,embed_dim),
        new aksquare.Linear(embed_dim,n_words),
        new aksquare.Softmax()
]);

let optim = new aksquare.OptimSGD(model,lr=0.001);
		let x_data = data[j]
        let y_data = label[j]
	let x = new aksquare.Tensor(1,n_words, false);
        x.setFrom(x_data)

        model.forward(x)

        let loss = new aksquare.Loss(y_data-1,model);
        total_loss += loss.out
		loss.backward()
		optim.step();
		optim.grad_zero()
	}
		let embed_weight = get_weight(model.models[0].W)
console.log(embed_weight[0].length)

For contribution and bugs contact us : [email protected]