id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
52,900
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/command/TextCommandFactory.java
TextCommandFactory.createVerbosityCommand
public final Command createVerbosityCommand(CountDownLatch latch, int level, boolean noreply) { return new TextVerbosityCommand(latch, level, noreply); }
java
public final Command createVerbosityCommand(CountDownLatch latch, int level, boolean noreply) { return new TextVerbosityCommand(latch, level, noreply); }
[ "public", "final", "Command", "createVerbosityCommand", "(", "CountDownLatch", "latch", ",", "int", "level", ",", "boolean", "noreply", ")", "{", "return", "new", "TextVerbosityCommand", "(", "latch", ",", "level", ",", "noreply", ")", ";", "}" ]
Create verbosity command @param latch @param level @param noreply @return
[ "Create", "verbosity", "command" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/command/TextCommandFactory.java#L79-L81
52,901
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/nio/impl/NioTCPSession.java
NioTCPSession.blockingRead
protected final int blockingRead() throws ClosedChannelException, IOException { int n = 0; int readCount = 0; Selector readSelector = SelectorFactory.getSelector(); SelectionKey tmpKey = null; try { if (this.selectableChannel.isOpen()) { tmpKey = this.selectableChannel.register(readSel...
java
protected final int blockingRead() throws ClosedChannelException, IOException { int n = 0; int readCount = 0; Selector readSelector = SelectorFactory.getSelector(); SelectionKey tmpKey = null; try { if (this.selectableChannel.isOpen()) { tmpKey = this.selectableChannel.register(readSel...
[ "protected", "final", "int", "blockingRead", "(", ")", "throws", "ClosedChannelException", ",", "IOException", "{", "int", "n", "=", "0", ";", "int", "readCount", "=", "0", ";", "Selector", "readSelector", "=", "SelectorFactory", ".", "getSelector", "(", ")", ...
Blocking read using temp selector @return @throws ClosedChannelException @throws IOException
[ "Blocking", "read", "using", "temp", "selector" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/nio/impl/NioTCPSession.java#L234-L270
52,902
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/transcoders/BaseSerializingTranscoder.java
BaseSerializingTranscoder.encodeString
protected byte[] encodeString(String in) { byte[] rv = null; try { rv = in.getBytes(this.charset); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } return rv; }
java
protected byte[] encodeString(String in) { byte[] rv = null; try { rv = in.getBytes(this.charset); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } return rv; }
[ "protected", "byte", "[", "]", "encodeString", "(", "String", "in", ")", "{", "byte", "[", "]", "rv", "=", "null", ";", "try", "{", "rv", "=", "in", ".", "getBytes", "(", "this", ".", "charset", ")", ";", "}", "catch", "(", "UnsupportedEncodingExcept...
Encode a string into the current character set.
[ "Encode", "a", "string", "into", "the", "current", "character", "set", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/transcoders/BaseSerializingTranscoder.java#L318-L326
52,903
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/impl/Optimizer.java
Optimizer.optimiezeMergeBuffer
@SuppressWarnings("unchecked") public final Command optimiezeMergeBuffer(Command optimiezeCommand, final Queue writeQueue, final Queue<Command> executingCmds, int sendBufferSize) { if (log.isDebugEnabled()) { log.debug("Optimieze merge buffer:" + optimiezeCommand.toString()); } if (this.optimi...
java
@SuppressWarnings("unchecked") public final Command optimiezeMergeBuffer(Command optimiezeCommand, final Queue writeQueue, final Queue<Command> executingCmds, int sendBufferSize) { if (log.isDebugEnabled()) { log.debug("Optimieze merge buffer:" + optimiezeCommand.toString()); } if (this.optimi...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "Command", "optimiezeMergeBuffer", "(", "Command", "optimiezeCommand", ",", "final", "Queue", "writeQueue", ",", "final", "Queue", "<", "Command", ">", "executingCmds", ",", "int", "sendBufferSiz...
merge buffers to fit socket's send buffer size @param currentCommand @return @throws InterruptedException
[ "merge", "buffers", "to", "fit", "socket", "s", "send", "buffer", "size" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/impl/Optimizer.java#L126-L138
52,904
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/impl/Optimizer.java
Optimizer.optimiezeGet
@SuppressWarnings("unchecked") public final Command optimiezeGet(final Queue writeQueue, final Queue<Command> executingCmds, Command optimiezeCommand) { if (optimiezeCommand.getCommandType() == CommandType.GET_ONE || optimiezeCommand.getCommandType() == CommandType.GETS_ONE) { if (this.optimie...
java
@SuppressWarnings("unchecked") public final Command optimiezeGet(final Queue writeQueue, final Queue<Command> executingCmds, Command optimiezeCommand) { if (optimiezeCommand.getCommandType() == CommandType.GET_ONE || optimiezeCommand.getCommandType() == CommandType.GETS_ONE) { if (this.optimie...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "Command", "optimiezeGet", "(", "final", "Queue", "writeQueue", ",", "final", "Queue", "<", "Command", ">", "executingCmds", ",", "Command", "optimiezeCommand", ")", "{", "if", "(", "optimiez...
Merge get operation to multi-get operation @param currentCmd @param mergeCommands @return @throws InterruptedException
[ "Merge", "get", "operation", "to", "multi", "-", "get", "operation" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/impl/Optimizer.java#L148-L159
52,905
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/auth/AuthInfo.java
AuthInfo.plain
public static AuthInfo plain(String username, String password) { return new AuthInfo(new PlainCallbackHandler(username, password), new String[] {"PLAIN"}); }
java
public static AuthInfo plain(String username, String password) { return new AuthInfo(new PlainCallbackHandler(username, password), new String[] {"PLAIN"}); }
[ "public", "static", "AuthInfo", "plain", "(", "String", "username", ",", "String", "password", ")", "{", "return", "new", "AuthInfo", "(", "new", "PlainCallbackHandler", "(", "username", ",", "password", ")", ",", "new", "String", "[", "]", "{", "\"PLAIN\"",...
Get a typical auth descriptor for PLAIN auth with the given username and password. @param u the username @param p the password @return an AuthInfo
[ "Get", "a", "typical", "auth", "descriptor", "for", "PLAIN", "auth", "with", "the", "given", "username", "and", "password", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/auth/AuthInfo.java#L48-L50
52,906
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/auth/AuthInfo.java
AuthInfo.cramMD5
public static AuthInfo cramMD5(String username, String password) { return new AuthInfo(new PlainCallbackHandler(username, password), new String[] {"CRAM-MD5"}); }
java
public static AuthInfo cramMD5(String username, String password) { return new AuthInfo(new PlainCallbackHandler(username, password), new String[] {"CRAM-MD5"}); }
[ "public", "static", "AuthInfo", "cramMD5", "(", "String", "username", ",", "String", "password", ")", "{", "return", "new", "AuthInfo", "(", "new", "PlainCallbackHandler", "(", "username", ",", "password", ")", ",", "new", "String", "[", "]", "{", "\"CRAM-MD...
Get a typical auth descriptor for CRAM-MD5 auth with the given username and password. @param u the username @param p the password @return an AuthInfo
[ "Get", "a", "typical", "auth", "descriptor", "for", "CRAM", "-", "MD5", "auth", "with", "the", "given", "username", "and", "password", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/auth/AuthInfo.java#L60-L62
52,907
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/aws/AWSElasticCacheClientBuilder.java
AWSElasticCacheClientBuilder.build
@Override public AWSElasticCacheClient build() throws IOException { AWSElasticCacheClient memcachedClient = new AWSElasticCacheClient(this.sessionLocator, this.sessionComparator, this.bufferAllocator, this.configuration, this.socketOptions, this.commandFactory, this.transcoder, th...
java
@Override public AWSElasticCacheClient build() throws IOException { AWSElasticCacheClient memcachedClient = new AWSElasticCacheClient(this.sessionLocator, this.sessionComparator, this.bufferAllocator, this.configuration, this.socketOptions, this.commandFactory, this.transcoder, th...
[ "@", "Override", "public", "AWSElasticCacheClient", "build", "(", ")", "throws", "IOException", "{", "AWSElasticCacheClient", "memcachedClient", "=", "new", "AWSElasticCacheClient", "(", "this", ".", "sessionLocator", ",", "this", ".", "sessionComparator", ",", "this"...
Returns a new instanceof AWSElasticCacheClient.
[ "Returns", "a", "new", "instanceof", "AWSElasticCacheClient", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/aws/AWSElasticCacheClientBuilder.java#L96-L107
52,908
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/util/ResourcesUtils.java
ResourcesUtils.getResourceURL
public static URL getResourceURL(String resource) throws IOException { URL url = null; ClassLoader loader = ResourcesUtils.class.getClassLoader(); if (loader != null) { url = loader.getResource(resource); } if (url == null) { url = ClassLoader.getSystemResource(resource); } if (u...
java
public static URL getResourceURL(String resource) throws IOException { URL url = null; ClassLoader loader = ResourcesUtils.class.getClassLoader(); if (loader != null) { url = loader.getResource(resource); } if (url == null) { url = ClassLoader.getSystemResource(resource); } if (u...
[ "public", "static", "URL", "getResourceURL", "(", "String", "resource", ")", "throws", "IOException", "{", "URL", "url", "=", "null", ";", "ClassLoader", "loader", "=", "ResourcesUtils", ".", "class", ".", "getClassLoader", "(", ")", ";", "if", "(", "loader"...
Returns the URL of the resource on the classpath @param resource The resource to find @throws IOException If the resource cannot be found or read @return The resource
[ "Returns", "the", "URL", "of", "the", "resource", "on", "the", "classpath" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/util/ResourcesUtils.java#L35-L48
52,909
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/util/ResourcesUtils.java
ResourcesUtils.getResourceAsStream
public static InputStream getResourceAsStream(String resource) throws IOException { InputStream in = null; ClassLoader loader = ResourcesUtils.class.getClassLoader(); if (loader != null) { in = loader.getResourceAsStream(resource); } if (in == null) { in = ClassLoader.getSystemResourceAs...
java
public static InputStream getResourceAsStream(String resource) throws IOException { InputStream in = null; ClassLoader loader = ResourcesUtils.class.getClassLoader(); if (loader != null) { in = loader.getResourceAsStream(resource); } if (in == null) { in = ClassLoader.getSystemResourceAs...
[ "public", "static", "InputStream", "getResourceAsStream", "(", "String", "resource", ")", "throws", "IOException", "{", "InputStream", "in", "=", "null", ";", "ClassLoader", "loader", "=", "ResourcesUtils", ".", "class", ".", "getClassLoader", "(", ")", ";", "if...
Returns a resource on the classpath as a Stream object @param resource The resource to find @throws IOException If the resource cannot be found or read @return The resource
[ "Returns", "a", "resource", "on", "the", "classpath", "as", "a", "Stream", "object" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/util/ResourcesUtils.java#L81-L94
52,910
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/nio/impl/NioController.java
NioController.initialSelectorManager
protected void initialSelectorManager() throws IOException { if (this.selectorManager == null) { this.selectorManager = new SelectorManager(this.selectorPoolSize, this, this.configuration); this.selectorManager.start(); } }
java
protected void initialSelectorManager() throws IOException { if (this.selectorManager == null) { this.selectorManager = new SelectorManager(this.selectorPoolSize, this, this.configuration); this.selectorManager.start(); } }
[ "protected", "void", "initialSelectorManager", "(", ")", "throws", "IOException", "{", "if", "(", "this", ".", "selectorManager", "==", "null", ")", "{", "this", ".", "selectorManager", "=", "new", "SelectorManager", "(", "this", ".", "selectorPoolSize", ",", ...
Start selector manager @throws IOException
[ "Start", "selector", "manager" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/nio/impl/NioController.java#L131-L136
52,911
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/nio/impl/NioController.java
NioController.onRead
public void onRead(SelectionKey key) { if (this.readEventDispatcher == null) { dispatchReadEvent(key); } else { this.readEventDispatcher.dispatch(new ReadTask(key)); } }
java
public void onRead(SelectionKey key) { if (this.readEventDispatcher == null) { dispatchReadEvent(key); } else { this.readEventDispatcher.dispatch(new ReadTask(key)); } }
[ "public", "void", "onRead", "(", "SelectionKey", "key", ")", "{", "if", "(", "this", ".", "readEventDispatcher", "==", "null", ")", "{", "dispatchReadEvent", "(", "key", ")", ";", "}", "else", "{", "this", ".", "readEventDispatcher", ".", "dispatch", "(", ...
Read event occured
[ "Read", "event", "occured" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/nio/impl/NioController.java#L148-L154
52,912
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/nio/impl/NioController.java
NioController.onWrite
public void onWrite(final SelectionKey key) { if (this.writeEventDispatcher == null) { dispatchWriteEvent(key); } else { this.writeEventDispatcher.dispatch(new WriteTask(key)); } }
java
public void onWrite(final SelectionKey key) { if (this.writeEventDispatcher == null) { dispatchWriteEvent(key); } else { this.writeEventDispatcher.dispatch(new WriteTask(key)); } }
[ "public", "void", "onWrite", "(", "final", "SelectionKey", "key", ")", "{", "if", "(", "this", ".", "writeEventDispatcher", "==", "null", ")", "{", "dispatchWriteEvent", "(", "key", ")", ";", "}", "else", "{", "this", ".", "writeEventDispatcher", ".", "dis...
Writable event occured
[ "Writable", "event", "occured" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/nio/impl/NioController.java#L159-L165
52,913
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/nio/impl/NioController.java
NioController.closeSelectionKey
public void closeSelectionKey(SelectionKey key) { if (key.attachment() instanceof Session) { Session session = (Session) key.attachment(); if (session != null) { session.close(); } } }
java
public void closeSelectionKey(SelectionKey key) { if (key.attachment() instanceof Session) { Session session = (Session) key.attachment(); if (session != null) { session.close(); } } }
[ "public", "void", "closeSelectionKey", "(", "SelectionKey", "key", ")", "{", "if", "(", "key", ".", "attachment", "(", ")", "instanceof", "Session", ")", "{", "Session", "session", "=", "(", "Session", ")", "key", ".", "attachment", "(", ")", ";", "if", ...
Cancel selection key
[ "Cancel", "selection", "key" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/nio/impl/NioController.java#L170-L177
52,914
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/nio/impl/NioController.java
NioController.buildSessionConfig
protected final NioSessionConfig buildSessionConfig(SelectableChannel sc, Queue<WriteMessage> queue) { final NioSessionConfig sessionConfig = new NioSessionConfig(sc, getHandler(), this.selectorManager, getCodecFactory(), getStatistics(), queue, this.dispatchMessageDispatcher, isHandleRead...
java
protected final NioSessionConfig buildSessionConfig(SelectableChannel sc, Queue<WriteMessage> queue) { final NioSessionConfig sessionConfig = new NioSessionConfig(sc, getHandler(), this.selectorManager, getCodecFactory(), getStatistics(), queue, this.dispatchMessageDispatcher, isHandleRead...
[ "protected", "final", "NioSessionConfig", "buildSessionConfig", "(", "SelectableChannel", "sc", ",", "Queue", "<", "WriteMessage", ">", "queue", ")", "{", "final", "NioSessionConfig", "sessionConfig", "=", "new", "NioSessionConfig", "(", "sc", ",", "getHandler", "("...
Build nio session config @param sc @param queue @return
[ "Build", "nio", "session", "config" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/nio/impl/NioController.java#L217-L224
52,915
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/command/binary/BinaryGetMultiCommand.java
BinaryGetMultiCommand.readHeader
protected void readHeader(ByteBuffer buffer) { super.readHeader(buffer); if (this.responseStatus != ResponseStatus.NO_ERROR) { if (ByteUtils.stepBuffer(buffer, this.responseTotalBodyLength)) { this.decodeStatus = BinaryDecodeStatus.DONE; } } }
java
protected void readHeader(ByteBuffer buffer) { super.readHeader(buffer); if (this.responseStatus != ResponseStatus.NO_ERROR) { if (ByteUtils.stepBuffer(buffer, this.responseTotalBodyLength)) { this.decodeStatus = BinaryDecodeStatus.DONE; } } }
[ "protected", "void", "readHeader", "(", "ByteBuffer", "buffer", ")", "{", "super", ".", "readHeader", "(", "buffer", ")", ";", "if", "(", "this", ".", "responseStatus", "!=", "ResponseStatus", ".", "NO_ERROR", ")", "{", "if", "(", "ByteUtils", ".", "stepBu...
optimistic,if response status is greater than zero,then skip buffer to next response,set result as null
[ "optimistic", "if", "response", "status", "is", "greater", "than", "zero", "then", "skip", "buffer", "to", "next", "response", "set", "result", "as", "null" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/command/binary/BinaryGetMultiCommand.java#L69-L76
52,916
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/aws/AWSElasticCacheClient.java
AWSElasticCacheClient.getConfig
public ClusterConfigration getConfig(String key) throws MemcachedException, InterruptedException, TimeoutException { Command cmd = this.commandFactory.createAWSElasticCacheConfigCommand("get", key); final Session session = this.sendCommand(cmd); this.latchWait(cmd, opTimeout, session); cmd.getIoBu...
java
public ClusterConfigration getConfig(String key) throws MemcachedException, InterruptedException, TimeoutException { Command cmd = this.commandFactory.createAWSElasticCacheConfigCommand("get", key); final Session session = this.sendCommand(cmd); this.latchWait(cmd, opTimeout, session); cmd.getIoBu...
[ "public", "ClusterConfigration", "getConfig", "(", "String", "key", ")", "throws", "MemcachedException", ",", "InterruptedException", ",", "TimeoutException", "{", "Command", "cmd", "=", "this", ".", "commandFactory", ".", "createAWSElasticCacheConfigCommand", "(", "\"g...
Get config by key from cache node by network command. @since 2.3.0 @return clusetr config.
[ "Get", "config", "by", "key", "from", "cache", "node", "by", "network", "command", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/aws/AWSElasticCacheClient.java#L253-L265
52,917
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/utils/ByteUtils.java
ByteUtils.nextLine
public static final String nextLine(ByteBuffer buffer) { if (buffer == null) { return null; } int index = MemcachedDecoder.SPLIT_MATCHER .matchFirst(com.google.code.yanf4j.buffer.IoBuffer.wrap(buffer)); if (index >= 0) { int limit = buffer.limit(); buffer.limit(index); b...
java
public static final String nextLine(ByteBuffer buffer) { if (buffer == null) { return null; } int index = MemcachedDecoder.SPLIT_MATCHER .matchFirst(com.google.code.yanf4j.buffer.IoBuffer.wrap(buffer)); if (index >= 0) { int limit = buffer.limit(); buffer.limit(index); b...
[ "public", "static", "final", "String", "nextLine", "(", "ByteBuffer", "buffer", ")", "{", "if", "(", "buffer", "==", "null", ")", "{", "return", "null", ";", "}", "int", "index", "=", "MemcachedDecoder", ".", "SPLIT_MATCHER", ".", "matchFirst", "(", "com",...
Read next line from ByteBuffer @param buffer @return
[ "Read", "next", "line", "from", "ByteBuffer" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/utils/ByteUtils.java#L257-L275
52,918
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/nio/impl/SocketChannelController.java
SocketChannelController.configureSocketChannel
protected final void configureSocketChannel(SocketChannel sc) throws IOException { sc.socket().setSoTimeout(this.soTimeout); sc.configureBlocking(false); if (this.socketOptions.get(StandardSocketOption.SO_REUSEADDR) != null) { sc.socket().setReuseAddress(StandardSocketOption.SO_REUSEADDR.type() ...
java
protected final void configureSocketChannel(SocketChannel sc) throws IOException { sc.socket().setSoTimeout(this.soTimeout); sc.configureBlocking(false); if (this.socketOptions.get(StandardSocketOption.SO_REUSEADDR) != null) { sc.socket().setReuseAddress(StandardSocketOption.SO_REUSEADDR.type() ...
[ "protected", "final", "void", "configureSocketChannel", "(", "SocketChannel", "sc", ")", "throws", "IOException", "{", "sc", ".", "socket", "(", ")", ".", "setSoTimeout", "(", "this", ".", "soTimeout", ")", ";", "sc", ".", "configureBlocking", "(", "false", ...
Confiure socket channel @param sc @throws IOException
[ "Confiure", "socket", "channel" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/nio/impl/SocketChannelController.java#L85-L113
52,919
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/command/binary/BinaryStoreCommand.java
BinaryStoreCommand.readHeader
protected void readHeader(ByteBuffer buffer) { super.readHeader(buffer); if (this.responseStatus == ResponseStatus.NO_ERROR) { this.decodeStatus = BinaryDecodeStatus.DONE; } }
java
protected void readHeader(ByteBuffer buffer) { super.readHeader(buffer); if (this.responseStatus == ResponseStatus.NO_ERROR) { this.decodeStatus = BinaryDecodeStatus.DONE; } }
[ "protected", "void", "readHeader", "(", "ByteBuffer", "buffer", ")", "{", "super", ".", "readHeader", "(", "buffer", ")", ";", "if", "(", "this", ".", "responseStatus", "==", "ResponseStatus", ".", "NO_ERROR", ")", "{", "this", ".", "decodeStatus", "=", "B...
optimistic,if no error,goto done
[ "optimistic", "if", "no", "error", "goto", "done" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/command/binary/BinaryStoreCommand.java#L60-L65
52,920
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/core/impl/AbstractController.java
AbstractController.bind
public void bind(InetSocketAddress inetSocketAddress) throws IOException { if (inetSocketAddress == null) { throw new IllegalArgumentException("Null inetSocketAddress"); } setLocalSocketAddress(inetSocketAddress); start(); }
java
public void bind(InetSocketAddress inetSocketAddress) throws IOException { if (inetSocketAddress == null) { throw new IllegalArgumentException("Null inetSocketAddress"); } setLocalSocketAddress(inetSocketAddress); start(); }
[ "public", "void", "bind", "(", "InetSocketAddress", "inetSocketAddress", ")", "throws", "IOException", "{", "if", "(", "inetSocketAddress", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null inetSocketAddress\"", ")", ";", "}", "setLoca...
Bind localhost address @param inetSocketAddress @throws IOException
[ "Bind", "localhost", "address" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/core/impl/AbstractController.java#L534-L540
52,921
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/impl/MemcachedHandler.java
MemcachedHandler.onMessageReceived
@Override public final void onMessageReceived(final Session session, final Object msg) { Command command = (Command) msg; if (this.statisticsHandler.isStatistics()) { if (command.getCopiedMergeCount() > 0 && command instanceof MapReturnValueAware) { Map<String, CachedData> returnValues = ((MapRe...
java
@Override public final void onMessageReceived(final Session session, final Object msg) { Command command = (Command) msg; if (this.statisticsHandler.isStatistics()) { if (command.getCopiedMergeCount() > 0 && command instanceof MapReturnValueAware) { Map<String, CachedData> returnValues = ((MapRe...
[ "@", "Override", "public", "final", "void", "onMessageReceived", "(", "final", "Session", "session", ",", "final", "Object", "msg", ")", "{", "Command", "command", "=", "(", "Command", ")", "msg", ";", "if", "(", "this", ".", "statisticsHandler", ".", "isS...
On receive message from memcached server
[ "On", "receive", "message", "from", "memcached", "server" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/impl/MemcachedHandler.java#L69-L93
52,922
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/impl/MemcachedHandler.java
MemcachedHandler.onSessionStarted
@Override public void onSessionStarted(Session session) { session.setUseBlockingRead(true); session.setAttribute(HEART_BEAT_FAIL_COUNT_ATTR, new AtomicInteger(0)); for (MemcachedClientStateListener listener : this.client.getStateListeners()) { listener.onConnected(this.client, session.getRemoteSocke...
java
@Override public void onSessionStarted(Session session) { session.setUseBlockingRead(true); session.setAttribute(HEART_BEAT_FAIL_COUNT_ATTR, new AtomicInteger(0)); for (MemcachedClientStateListener listener : this.client.getStateListeners()) { listener.onConnected(this.client, session.getRemoteSocke...
[ "@", "Override", "public", "void", "onSessionStarted", "(", "Session", "session", ")", "{", "session", ".", "setUseBlockingRead", "(", "true", ")", ";", "session", ".", "setAttribute", "(", "HEART_BEAT_FAIL_COUNT_ATTR", ",", "new", "AtomicInteger", "(", "0", ")"...
On session started
[ "On", "session", "started" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/impl/MemcachedHandler.java#L134-L142
52,923
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/impl/MemcachedHandler.java
MemcachedHandler.reconnect
protected void reconnect(MemcachedTCPSession session) { if (!this.client.isShutdown()) { // Prevent reconnecting repeatedly synchronized (session) { if (!session.isAllowReconnect()) { return; } session.setAllowReconnect(false); } MemcachedSession memcachedTC...
java
protected void reconnect(MemcachedTCPSession session) { if (!this.client.isShutdown()) { // Prevent reconnecting repeatedly synchronized (session) { if (!session.isAllowReconnect()) { return; } session.setAllowReconnect(false); } MemcachedSession memcachedTC...
[ "protected", "void", "reconnect", "(", "MemcachedTCPSession", "session", ")", "{", "if", "(", "!", "this", ".", "client", ".", "isShutdown", "(", ")", ")", "{", "// Prevent reconnecting repeatedly", "synchronized", "(", "session", ")", "{", "if", "(", "!", "...
Auto reconect to memcached server @param session
[ "Auto", "reconect", "to", "memcached", "server" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/impl/MemcachedHandler.java#L243-L258
52,924
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/buffer/IoBuffer.java
IoBuffer.setAllocator
public static void setAllocator(IoBufferAllocator newAllocator) { if (newAllocator == null) { throw new NullPointerException("allocator"); } IoBufferAllocator oldAllocator = allocator; allocator = newAllocator; if (null != oldAllocator) { oldAllocator.dispose(); } }
java
public static void setAllocator(IoBufferAllocator newAllocator) { if (newAllocator == null) { throw new NullPointerException("allocator"); } IoBufferAllocator oldAllocator = allocator; allocator = newAllocator; if (null != oldAllocator) { oldAllocator.dispose(); } }
[ "public", "static", "void", "setAllocator", "(", "IoBufferAllocator", "newAllocator", ")", "{", "if", "(", "newAllocator", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"allocator\"", ")", ";", "}", "IoBufferAllocator", "oldAllocator", "="...
Sets the allocator used by existing and new buffers
[ "Sets", "the", "allocator", "used", "by", "existing", "and", "new", "buffers" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/buffer/IoBuffer.java#L154-L166
52,925
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/buffer/IoBuffer.java
IoBuffer.allocate
public static IoBuffer allocate(int capacity, boolean direct) { if (capacity < 0) { throw new IllegalArgumentException("capacity: " + capacity); } return allocator.allocate(capacity, direct); }
java
public static IoBuffer allocate(int capacity, boolean direct) { if (capacity < 0) { throw new IllegalArgumentException("capacity: " + capacity); } return allocator.allocate(capacity, direct); }
[ "public", "static", "IoBuffer", "allocate", "(", "int", "capacity", ",", "boolean", "direct", ")", "{", "if", "(", "capacity", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"capacity: \"", "+", "capacity", ")", ";", "}", "return", ...
Returns the buffer which is capable of the specified size. @param capacity the capacity of the buffer @param direct <tt>true</tt> to get a direct buffer, <tt>false</tt> to get a heap buffer.
[ "Returns", "the", "buffer", "which", "is", "capable", "of", "the", "specified", "size", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/buffer/IoBuffer.java#L201-L207
52,926
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/buffer/IoBuffer.java
IoBuffer.wrap
public static IoBuffer wrap(byte[] byteArray, int offset, int length) { return wrap(ByteBuffer.wrap(byteArray, offset, length)); }
java
public static IoBuffer wrap(byte[] byteArray, int offset, int length) { return wrap(ByteBuffer.wrap(byteArray, offset, length)); }
[ "public", "static", "IoBuffer", "wrap", "(", "byte", "[", "]", "byteArray", ",", "int", "offset", ",", "int", "length", ")", "{", "return", "wrap", "(", "ByteBuffer", ".", "wrap", "(", "byteArray", ",", "offset", ",", "length", ")", ")", ";", "}" ]
Wraps the specified byte array into MINA heap buffer.
[ "Wraps", "the", "specified", "byte", "array", "into", "MINA", "heap", "buffer", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/buffer/IoBuffer.java#L226-L228
52,927
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/nio/impl/Reactor.java
Reactor.lookJVMBug
private boolean lookJVMBug(long before, int selected, long wait) throws IOException { boolean seeing = false; long now = System.currentTimeMillis(); if (JVMBUG_THRESHHOLD > 0 && selected == 0 && wait > JVMBUG_THRESHHOLD && now - before < wait / 4 && !wakenUp.get() /* waken up */ && !Thread....
java
private boolean lookJVMBug(long before, int selected, long wait) throws IOException { boolean seeing = false; long now = System.currentTimeMillis(); if (JVMBUG_THRESHHOLD > 0 && selected == 0 && wait > JVMBUG_THRESHHOLD && now - before < wait / 4 && !wakenUp.get() /* waken up */ && !Thread....
[ "private", "boolean", "lookJVMBug", "(", "long", "before", ",", "int", "selected", ",", "long", "wait", ")", "throws", "IOException", "{", "boolean", "seeing", "=", "false", ";", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", ...
Look jvm bug @param before @param selected @param wait @return @throws IOException
[ "Look", "jvm", "bug" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/nio/impl/Reactor.java#L205-L271
52,928
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/nio/impl/Reactor.java
Reactor.dispatchEvent
public final void dispatchEvent(Set<SelectionKey> selectedKeySet) { Iterator<SelectionKey> it = selectedKeySet.iterator(); boolean skipOpRead = false; while (it.hasNext()) { SelectionKey key = it.next(); it.remove(); if (!key.isValid()) { if (key.attachment() != null) { c...
java
public final void dispatchEvent(Set<SelectionKey> selectedKeySet) { Iterator<SelectionKey> it = selectedKeySet.iterator(); boolean skipOpRead = false; while (it.hasNext()) { SelectionKey key = it.next(); it.remove(); if (!key.isValid()) { if (key.attachment() != null) { c...
[ "public", "final", "void", "dispatchEvent", "(", "Set", "<", "SelectionKey", ">", "selectedKeySet", ")", "{", "Iterator", "<", "SelectionKey", ">", "it", "=", "selectedKeySet", ".", "iterator", "(", ")", ";", "boolean", "skipOpRead", "=", "false", ";", "whil...
Dispatch selected event @param selectedKeySet
[ "Dispatch", "selected", "event" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/nio/impl/Reactor.java#L278-L347
52,929
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java
XMemcachedClient.addServer
public final void addServer(final String server, final int port, int weight) throws IOException { if (weight <= 0) { throw new IllegalArgumentException("weight<=0"); } this.checkServerPort(server, port); this.connect(new InetSocketAddressWrapper(this.newSocketAddress(server, port), this.se...
java
public final void addServer(final String server, final int port, int weight) throws IOException { if (weight <= 0) { throw new IllegalArgumentException("weight<=0"); } this.checkServerPort(server, port); this.connect(new InetSocketAddressWrapper(this.newSocketAddress(server, port), this.se...
[ "public", "final", "void", "addServer", "(", "final", "String", "server", ",", "final", "int", "port", ",", "int", "weight", ")", "throws", "IOException", "{", "if", "(", "weight", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"we...
add a memcached server to MemcachedClient @param server @param port @param weight @throws IOException
[ "add", "a", "memcached", "server", "to", "MemcachedClient" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java#L391-L398
52,930
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java
XMemcachedClient.catalogKeys
private final Collection<List<String>> catalogKeys(final Collection<String> keyCollections) { final Map<Session, List<String>> catalogMap = new HashMap<Session, List<String>>(); for (String key : keyCollections) { Session index = this.sessionLocator.getSessionByKey(key); List<String> tmpKeys = cata...
java
private final Collection<List<String>> catalogKeys(final Collection<String> keyCollections) { final Map<Session, List<String>> catalogMap = new HashMap<Session, List<String>>(); for (String key : keyCollections) { Session index = this.sessionLocator.getSessionByKey(key); List<String> tmpKeys = cata...
[ "private", "final", "Collection", "<", "List", "<", "String", ">", ">", "catalogKeys", "(", "final", "Collection", "<", "String", ">", "keyCollections", ")", "{", "final", "Map", "<", "Session", ",", "List", "<", "String", ">", ">", "catalogMap", "=", "n...
Hash key to servers @param keyCollections @return
[ "Hash", "key", "to", "servers" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java#L1234-L1249
52,931
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java
XMemcachedClient.deleteWithNoReply
public final void deleteWithNoReply(final String key, final int time) throws InterruptedException, MemcachedException { try { this.delete0(key, time, 0, true, this.opTimeout); } catch (TimeoutException e) { throw new MemcachedException(e); } }
java
public final void deleteWithNoReply(final String key, final int time) throws InterruptedException, MemcachedException { try { this.delete0(key, time, 0, true, this.opTimeout); } catch (TimeoutException e) { throw new MemcachedException(e); } }
[ "public", "final", "void", "deleteWithNoReply", "(", "final", "String", "key", ",", "final", "int", "time", ")", "throws", "InterruptedException", ",", "MemcachedException", "{", "try", "{", "this", ".", "delete0", "(", "key", ",", "time", ",", "0", ",", "...
Delete key's data item from memcached.This method doesn't wait for reply @param key @param time @throws InterruptedException @throws MemcachedException
[ "Delete", "key", "s", "data", "item", "from", "memcached", ".", "This", "method", "doesn", "t", "wait", "for", "reply" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java#L1782-L1789
52,932
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java
XMemcachedClient.getNamespace
public String getNamespace(String ns) throws TimeoutException, InterruptedException, MemcachedException { String key = this.keyProvider.process(this.getNSKey(ns)); byte[] keyBytes = ByteUtils.getBytes(key); ByteUtils.checkKey(keyBytes); Object item = this.fetch0(key, keyBytes, CommandType.GET_ONE,...
java
public String getNamespace(String ns) throws TimeoutException, InterruptedException, MemcachedException { String key = this.keyProvider.process(this.getNSKey(ns)); byte[] keyBytes = ByteUtils.getBytes(key); ByteUtils.checkKey(keyBytes); Object item = this.fetch0(key, keyBytes, CommandType.GET_ONE,...
[ "public", "String", "getNamespace", "(", "String", "ns", ")", "throws", "TimeoutException", ",", "InterruptedException", ",", "MemcachedException", "{", "String", "key", "=", "this", ".", "keyProvider", ".", "process", "(", "this", ".", "getNSKey", "(", "ns", ...
Returns the real namespace of ns. @param ns @return @throws TimeoutException @throws InterruptedException @throws MemcachedException
[ "Returns", "the", "real", "namespace", "of", "ns", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java#L2545-L2564
52,933
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/util/SelectorFactory.java
SelectorFactory.setMaxSelectors
public final static void setMaxSelectors(int size) throws IOException { synchronized (selectors) { if (size < maxSelectors) { reduce(size); } else if (size > maxSelectors) { grow(size); } maxSelectors = size; } }
java
public final static void setMaxSelectors(int size) throws IOException { synchronized (selectors) { if (size < maxSelectors) { reduce(size); } else if (size > maxSelectors) { grow(size); } maxSelectors = size; } }
[ "public", "final", "static", "void", "setMaxSelectors", "(", "int", "size", ")", "throws", "IOException", "{", "synchronized", "(", "selectors", ")", "{", "if", "(", "size", "<", "maxSelectors", ")", "{", "reduce", "(", "size", ")", ";", "}", "else", "if...
Set max selector pool size. @param size max pool size
[ "Set", "max", "selector", "pool", "size", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/util/SelectorFactory.java#L66-L76
52,934
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/util/LinkedTransferQueue.java
LinkedTransferQueue.advanceHead
private boolean advanceHead(QNode h, QNode nh) { if (h == this.head.get() && this.head.compareAndSet(h, nh)) { h.next = h; // forget old next return true; } return false; }
java
private boolean advanceHead(QNode h, QNode nh) { if (h == this.head.get() && this.head.compareAndSet(h, nh)) { h.next = h; // forget old next return true; } return false; }
[ "private", "boolean", "advanceHead", "(", "QNode", "h", ",", "QNode", "nh", ")", "{", "if", "(", "h", "==", "this", ".", "head", ".", "get", "(", ")", "&&", "this", ".", "head", ".", "compareAndSet", "(", "h", ",", "nh", ")", ")", "{", "h", "."...
Tries to cas nh as new head; if successful, unlink old head's next node to avoid garbage retention.
[ "Tries", "to", "cas", "nh", "as", "new", "head", ";", "if", "successful", "unlink", "old", "head", "s", "next", "node", "to", "avoid", "garbage", "retention", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/util/LinkedTransferQueue.java#L203-L209
52,935
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/util/LinkedTransferQueue.java
LinkedTransferQueue.getValidatedTail
private QNode getValidatedTail() { for (;;) { QNode h = this.head.get(); QNode first = h.next; if (first != null && first.next == first) { // help advance advanceHead(h, first); continue; } QNode t = this.tail.get(); QNode last = t.next; if (t == this.tail.g...
java
private QNode getValidatedTail() { for (;;) { QNode h = this.head.get(); QNode first = h.next; if (first != null && first.next == first) { // help advance advanceHead(h, first); continue; } QNode t = this.tail.get(); QNode last = t.next; if (t == this.tail.g...
[ "private", "QNode", "getValidatedTail", "(", ")", "{", "for", "(", ";", ";", ")", "{", "QNode", "h", "=", "this", ".", "head", ".", "get", "(", ")", ";", "QNode", "first", "=", "h", ".", "next", ";", "if", "(", "first", "!=", "null", "&&", "fir...
Returns validated tail for use in cleaning methods
[ "Returns", "validated", "tail", "for", "use", "in", "cleaning", "methods" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/util/LinkedTransferQueue.java#L362-L380
52,936
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/util/LinkedTransferQueue.java
LinkedTransferQueue.traversalHead
QNode traversalHead() { for (;;) { QNode t = this.tail.get(); QNode h = this.head.get(); if (h != null && t != null) { QNode last = t.next; QNode first = h.next; if (t == this.tail.get()) { if (last != null) { this.tail.compareAndSet(t, last); ...
java
QNode traversalHead() { for (;;) { QNode t = this.tail.get(); QNode h = this.head.get(); if (h != null && t != null) { QNode last = t.next; QNode first = h.next; if (t == this.tail.get()) { if (last != null) { this.tail.compareAndSet(t, last); ...
[ "QNode", "traversalHead", "(", ")", "{", "for", "(", ";", ";", ")", "{", "QNode", "t", "=", "this", ".", "tail", ".", "get", "(", ")", ";", "QNode", "h", "=", "this", ".", "head", ".", "get", "(", ")", ";", "if", "(", "h", "!=", "null", "&&...
Return head after performing any outstanding helping steps
[ "Return", "head", "after", "performing", "any", "outstanding", "helping", "steps" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/util/LinkedTransferQueue.java#L592-L615
52,937
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/aws/AWSUtils.java
AWSUtils.parseConfiguration
public static ClusterConfigration parseConfiguration(String line) { String[] lines = line.trim().split("(?:\\r?\\n)"); if (lines.length < 2) { throw new IllegalArgumentException("Incorrect config response:" + line); } String configversion = lines[0]; String nodeListStr = lines[1]; if (!Byt...
java
public static ClusterConfigration parseConfiguration(String line) { String[] lines = line.trim().split("(?:\\r?\\n)"); if (lines.length < 2) { throw new IllegalArgumentException("Incorrect config response:" + line); } String configversion = lines[0]; String nodeListStr = lines[1]; if (!Byt...
[ "public", "static", "ClusterConfigration", "parseConfiguration", "(", "String", "line", ")", "{", "String", "[", "]", "lines", "=", "line", ".", "trim", "(", ")", ".", "split", "(", "\"(?:\\\\r?\\\\n)\"", ")", ";", "if", "(", "lines", ".", "length", "<", ...
Parse response string to ClusterConfiguration instance. @param line @return
[ "Parse", "response", "string", "to", "ClusterConfiguration", "instance", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/aws/AWSUtils.java#L23-L57
52,938
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/Counter.java
Counter.get
public long get() throws MemcachedException, InterruptedException, TimeoutException { Object result = this.memcachedClient.get(this.key); if (result == null) { throw new MemcachedClientException("key is not existed."); } else { if (result instanceof Long) return (Long) result; else...
java
public long get() throws MemcachedException, InterruptedException, TimeoutException { Object result = this.memcachedClient.get(this.key); if (result == null) { throw new MemcachedClientException("key is not existed."); } else { if (result instanceof Long) return (Long) result; else...
[ "public", "long", "get", "(", ")", "throws", "MemcachedException", ",", "InterruptedException", ",", "TimeoutException", "{", "Object", "result", "=", "this", ".", "memcachedClient", ".", "get", "(", "this", ".", "key", ")", ";", "if", "(", "result", "==", ...
Get current value @return @throws MemcachedException @throws InterruptedException @throws TimeoutException
[ "Get", "current", "value" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/Counter.java#L69-L79
52,939
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/Counter.java
Counter.set
public void set(long value) throws MemcachedException, InterruptedException, TimeoutException { this.memcachedClient.set(this.key, 0, String.valueOf(value)); }
java
public void set(long value) throws MemcachedException, InterruptedException, TimeoutException { this.memcachedClient.set(this.key, 0, String.valueOf(value)); }
[ "public", "void", "set", "(", "long", "value", ")", "throws", "MemcachedException", ",", "InterruptedException", ",", "TimeoutException", "{", "this", ".", "memcachedClient", ".", "set", "(", "this", ".", "key", ",", "0", ",", "String", ".", "valueOf", "(", ...
Set counter's value to expected. @param value @throws MemcachedException @throws InterruptedException @throws TimeoutException
[ "Set", "counter", "s", "value", "to", "expected", "." ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/Counter.java#L89-L91
52,940
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/Counter.java
Counter.addAndGet
public long addAndGet(long delta) throws MemcachedException, InterruptedException, TimeoutException { if (delta >= 0) { return this.memcachedClient.incr(this.key, delta, this.initialValue); } else { return this.memcachedClient.decr(this.key, -delta, this.initialValue); } }
java
public long addAndGet(long delta) throws MemcachedException, InterruptedException, TimeoutException { if (delta >= 0) { return this.memcachedClient.incr(this.key, delta, this.initialValue); } else { return this.memcachedClient.decr(this.key, -delta, this.initialValue); } }
[ "public", "long", "addAndGet", "(", "long", "delta", ")", "throws", "MemcachedException", ",", "InterruptedException", ",", "TimeoutException", "{", "if", "(", "delta", ">=", "0", ")", "{", "return", "this", ".", "memcachedClient", ".", "incr", "(", "this", ...
Add value and get the result @param delta @return @throws MemcachedException @throws InterruptedException @throws TimeoutException
[ "Add", "value", "and", "get", "the", "result" ]
66150915938813b3e3413de1d7b43b6ff9b1478d
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/Counter.java#L140-L147
52,941
fasseg/exp4j
src/main/java/net/objecthunter/exp4j/function/Function.java
Function.getAllowedFunctionCharacters
public static char[] getAllowedFunctionCharacters() { char[] chars = new char[53]; int count = 0; for (int i = 65; i < 91; i++) { chars[count++] = (char) i; } for (int i = 97; i < 123; i++) { chars[count++] = (char) i; } chars[count] = '_';...
java
public static char[] getAllowedFunctionCharacters() { char[] chars = new char[53]; int count = 0; for (int i = 65; i < 91; i++) { chars[count++] = (char) i; } for (int i = 97; i < 123; i++) { chars[count++] = (char) i; } chars[count] = '_';...
[ "public", "static", "char", "[", "]", "getAllowedFunctionCharacters", "(", ")", "{", "char", "[", "]", "chars", "=", "new", "char", "[", "53", "]", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "65", ";", "i", "<", "91", ";", ...
Get the set of characters which are allowed for use in Function names. @return the set of characters allowed @deprecated since 0.4.5 All unicode letters are allowed to be used in function names since 0.4.3. This API Function can be safely ignored. Checks for function name validity can be done using Character.isLetter(...
[ "Get", "the", "set", "of", "characters", "which", "are", "allowed", "for", "use", "in", "Function", "names", "." ]
3efb9944a9fe99e3f379b6426e0d20d061358793
https://github.com/fasseg/exp4j/blob/3efb9944a9fe99e3f379b6426e0d20d061358793/src/main/java/net/objecthunter/exp4j/function/Function.java#L89-L100
52,942
fasseg/exp4j
src/main/java/net/objecthunter/exp4j/function/Functions.java
Functions.getBuiltinFunction
public static Function getBuiltinFunction(final String name) { if (name.equals("sin")) { return builtinFunctions[INDEX_SIN]; } else if (name.equals("cos")) { return builtinFunctions[INDEX_COS]; } else if (name.equals("tan")) { return builtinFunctions[INDEX_TA...
java
public static Function getBuiltinFunction(final String name) { if (name.equals("sin")) { return builtinFunctions[INDEX_SIN]; } else if (name.equals("cos")) { return builtinFunctions[INDEX_COS]; } else if (name.equals("tan")) { return builtinFunctions[INDEX_TA...
[ "public", "static", "Function", "getBuiltinFunction", "(", "final", "String", "name", ")", "{", "if", "(", "name", ".", "equals", "(", "\"sin\"", ")", ")", "{", "return", "builtinFunctions", "[", "INDEX_SIN", "]", ";", "}", "else", "if", "(", "name", "."...
Get the builtin function for a given name @param name te name of the function @return a Function instance
[ "Get", "the", "builtin", "function", "for", "a", "given", "name" ]
3efb9944a9fe99e3f379b6426e0d20d061358793
https://github.com/fasseg/exp4j/blob/3efb9944a9fe99e3f379b6426e0d20d061358793/src/main/java/net/objecthunter/exp4j/function/Functions.java#L204-L255
52,943
EdwardRaff/JSAT
JSAT/src/jsat/utils/BooleanList.java
BooleanList.unmodifiableView
public static List<Boolean> unmodifiableView(boolean[] array, int length) { return Collections.unmodifiableList(view(array, length)); }
java
public static List<Boolean> unmodifiableView(boolean[] array, int length) { return Collections.unmodifiableList(view(array, length)); }
[ "public", "static", "List", "<", "Boolean", ">", "unmodifiableView", "(", "boolean", "[", "]", "array", ",", "int", "length", ")", "{", "return", "Collections", ".", "unmodifiableList", "(", "view", "(", "array", ",", "length", ")", ")", ";", "}" ]
Creates an returns an unmodifiable view of the given boolean array that requires only a small object allocation. @param array the array to wrap into an unmodifiable list @param length the number of values of the array to use, starting from zero @return an unmodifiable list view of the array
[ "Creates", "an", "returns", "an", "unmodifiable", "view", "of", "the", "given", "boolean", "array", "that", "requires", "only", "a", "small", "object", "allocation", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/BooleanList.java#L269-L272
52,944
EdwardRaff/JSAT
JSAT/src/jsat/utils/BooleanList.java
BooleanList.view
public static BooleanList view(boolean[] array, int length) { if(length > array.length || length < 0) throw new IllegalArgumentException("length must be non-negative and no more than the size of the array("+array.length+"), not " + length); return new BooleanList(array, length); }
java
public static BooleanList view(boolean[] array, int length) { if(length > array.length || length < 0) throw new IllegalArgumentException("length must be non-negative and no more than the size of the array("+array.length+"), not " + length); return new BooleanList(array, length); }
[ "public", "static", "BooleanList", "view", "(", "boolean", "[", "]", "array", ",", "int", "length", ")", "{", "if", "(", "length", ">", "array", ".", "length", "||", "length", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"length must b...
Creates and returns a view of the given boolean array that requires only a small object allocation. Changes to the list will be reflected in the array up to a point. If the modification would require increasing the capacity of the array, a new array will be allocated - at which point operations will no longer be reflec...
[ "Creates", "and", "returns", "a", "view", "of", "the", "given", "boolean", "array", "that", "requires", "only", "a", "small", "object", "allocation", ".", "Changes", "to", "the", "list", "will", "be", "reflected", "in", "the", "array", "up", "to", "a", "...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/BooleanList.java#L286-L291
52,945
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java
BackPropagationNet.setMomentum
public void setMomentum(double momentum) { if(momentum < 0 || Double.isNaN(momentum) || Double.isInfinite(momentum)) throw new ArithmeticException("Momentum must be non negative, not " + momentum); this.momentum = momentum; }
java
public void setMomentum(double momentum) { if(momentum < 0 || Double.isNaN(momentum) || Double.isInfinite(momentum)) throw new ArithmeticException("Momentum must be non negative, not " + momentum); this.momentum = momentum; }
[ "public", "void", "setMomentum", "(", "double", "momentum", ")", "{", "if", "(", "momentum", "<", "0", "||", "Double", ".", "isNaN", "(", "momentum", ")", "||", "Double", ".", "isInfinite", "(", "momentum", ")", ")", "throw", "new", "ArithmeticException", ...
Sets the non negative momentum used in training. @param momentum the momentum to apply to training
[ "Sets", "the", "non", "negative", "momentum", "used", "in", "training", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java#L315-L320
52,946
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java
BackPropagationNet.setWeightDecay
public void setWeightDecay(double weightDecay) { if(weightDecay < 0 || weightDecay >= 1 || Double.isNaN(weightDecay)) throw new ArithmeticException("Weight decay must be in [0,1), not " + weightDecay); this.weightDecay = weightDecay; }
java
public void setWeightDecay(double weightDecay) { if(weightDecay < 0 || weightDecay >= 1 || Double.isNaN(weightDecay)) throw new ArithmeticException("Weight decay must be in [0,1), not " + weightDecay); this.weightDecay = weightDecay; }
[ "public", "void", "setWeightDecay", "(", "double", "weightDecay", ")", "{", "if", "(", "weightDecay", "<", "0", "||", "weightDecay", ">=", "1", "||", "Double", ".", "isNaN", "(", "weightDecay", ")", ")", "throw", "new", "ArithmeticException", "(", "\"Weight ...
Sets the weight decay used for each update. The weight decay must be in the range [0, 1). Weight decay values must often be very small, often 1e-8 or less. @param weightDecay the weight decay to apply when training
[ "Sets", "the", "weight", "decay", "used", "for", "each", "update", ".", "The", "weight", "decay", "must", "be", "in", "the", "range", "[", "0", "1", ")", ".", "Weight", "decay", "values", "must", "often", "be", "very", "small", "often", "1e", "-", "8...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java#L397-L402
52,947
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java
BackPropagationNet.setUp
private void setUp(Random rand) { Ws = new ArrayList<>(npl.length); bs = new ArrayList<>(npl.length); //First Hiden layer takes input raw DenseMatrix W = new DenseMatrix(npl[0], inputSize); Vec b = new DenseVector(W.rows()); initializeWeights(W, rand); ...
java
private void setUp(Random rand) { Ws = new ArrayList<>(npl.length); bs = new ArrayList<>(npl.length); //First Hiden layer takes input raw DenseMatrix W = new DenseMatrix(npl[0], inputSize); Vec b = new DenseVector(W.rows()); initializeWeights(W, rand); ...
[ "private", "void", "setUp", "(", "Random", "rand", ")", "{", "Ws", "=", "new", "ArrayList", "<>", "(", "npl", ".", "length", ")", ";", "bs", "=", "new", "ArrayList", "<>", "(", "npl", ".", "length", ")", ";", "//First Hiden layer takes input raw", "Dense...
Creates the weights for the hidden layers and output layer @param rand source of randomness
[ "Creates", "the", "weights", "for", "the", "hidden", "layers", "and", "output", "layer" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java#L737-L769
52,948
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java
BackPropagationNet.computeOutputDelta
private double computeOutputDelta(DataSet dataSet, final int idx, Vec delta_out, Vec a_i, Vec d_i) { double error = 0; if (dataSet instanceof ClassificationDataSet) { ClassificationDataSet cds = (ClassificationDataSet) dataSet; final int ct = cds.getDataPointCategory(...
java
private double computeOutputDelta(DataSet dataSet, final int idx, Vec delta_out, Vec a_i, Vec d_i) { double error = 0; if (dataSet instanceof ClassificationDataSet) { ClassificationDataSet cds = (ClassificationDataSet) dataSet; final int ct = cds.getDataPointCategory(...
[ "private", "double", "computeOutputDelta", "(", "DataSet", "dataSet", ",", "final", "int", "idx", ",", "Vec", "delta_out", ",", "Vec", "a_i", ",", "Vec", "d_i", ")", "{", "double", "error", "=", "0", ";", "if", "(", "dataSet", "instanceof", "Classification...
Computes the delta between the networks output for a same and its true value @param dataSet the data set we are learning from @param idx the index into the data set for the current data point @param delta_out the place to store the delta, may already be initialized with random noise @param a_i the activation of the fin...
[ "Computes", "the", "delta", "between", "the", "networks", "output", "for", "a", "same", "and", "its", "true", "value" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java#L780-L816
52,949
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java
BackPropagationNet.feedForward
private void feedForward(Vec input, List<Vec> activations, List<Vec> derivatives) { Vec x = input; for(int i = 0; i < Ws.size(); i++) { Matrix W_i = Ws.get(i); Vec b_i = bs.get(i); Vec a_i = activations.get(i); a_i.zeroOut(); W_i.m...
java
private void feedForward(Vec input, List<Vec> activations, List<Vec> derivatives) { Vec x = input; for(int i = 0; i < Ws.size(); i++) { Matrix W_i = Ws.get(i); Vec b_i = bs.get(i); Vec a_i = activations.get(i); a_i.zeroOut(); W_i.m...
[ "private", "void", "feedForward", "(", "Vec", "input", ",", "List", "<", "Vec", ">", "activations", ",", "List", "<", "Vec", ">", "derivatives", ")", "{", "Vec", "x", "=", "input", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "Ws", ".", ...
Feeds a vector through the network to get an output @param input the input to feed forward though the network @param activations the list of allocated vectors to store the activation outputs for each layer @param derivatives the list of allocated vectors to store the derivatives of the activations
[ "Feeds", "a", "vector", "through", "the", "network", "to", "get", "an", "output" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java#L826-L847
52,950
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java
BackPropagationNet.feedForward
private Vec feedForward(Vec input) { Vec x = input; for(int i = 0; i < Ws.size(); i++) { Matrix W_i = Ws.get(i); Vec b_i = bs.get(i); Vec a_i = W_i.multiply(x); a_i.mutableAdd(b_i); a_i.applyFunction(f); ...
java
private Vec feedForward(Vec input) { Vec x = input; for(int i = 0; i < Ws.size(); i++) { Matrix W_i = Ws.get(i); Vec b_i = bs.get(i); Vec a_i = W_i.multiply(x); a_i.mutableAdd(b_i); a_i.applyFunction(f); ...
[ "private", "Vec", "feedForward", "(", "Vec", "input", ")", "{", "Vec", "x", "=", "input", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "Ws", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Matrix", "W_i", "=", "Ws", ".", "get", "...
Feeds an input through the network @param inputthe input vector to feed in @return the output vector for the given input at the final layer
[ "Feeds", "an", "input", "through", "the", "network" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/BackPropagationNet.java#L854-L871
52,951
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/PegasosK.java
PegasosK.setRegularization
public void setRegularization(double regularization) { if(Double.isNaN(regularization) || Double.isInfinite(regularization) || regularization <= 0) throw new ArithmeticException("Regularization must be a positive constant, not " + regularization); this.regularization = regularization; ...
java
public void setRegularization(double regularization) { if(Double.isNaN(regularization) || Double.isInfinite(regularization) || regularization <= 0) throw new ArithmeticException("Regularization must be a positive constant, not " + regularization); this.regularization = regularization; ...
[ "public", "void", "setRegularization", "(", "double", "regularization", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "regularization", ")", "||", "Double", ".", "isInfinite", "(", "regularization", ")", "||", "regularization", "<=", "0", ")", "throw", "...
Sets the amount of regularization to apply. The regularization must be a positive value @param regularization the amount of regularization to apply
[ "Sets", "the", "amount", "of", "regularization", "to", "apply", ".", "The", "regularization", "must", "be", "a", "positive", "value" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/PegasosK.java#L107-L112
52,952
EdwardRaff/JSAT
JSAT/src/jsat/linear/EigenValueDecomposition.java
EigenValueDecomposition.sortByEigenValue
public void sortByEigenValue(Comparator<Double> cmp) { if(isComplex()) throw new ArithmeticException("Eigen values can not be sorted due to complex results"); IndexTable it = new IndexTable(DoubleList.unmodifiableView(d, d.length), cmp); for(int i = 0; i < d.length; i++)...
java
public void sortByEigenValue(Comparator<Double> cmp) { if(isComplex()) throw new ArithmeticException("Eigen values can not be sorted due to complex results"); IndexTable it = new IndexTable(DoubleList.unmodifiableView(d, d.length), cmp); for(int i = 0; i < d.length; i++)...
[ "public", "void", "sortByEigenValue", "(", "Comparator", "<", "Double", ">", "cmp", ")", "{", "if", "(", "isComplex", "(", ")", ")", "throw", "new", "ArithmeticException", "(", "\"Eigen values can not be sorted due to complex results\"", ")", ";", "IndexTable", "it"...
Sorts the eigen values and the corresponding eigenvector columns by the associated eigen value. Sorting can not occur if complex values are present. @param cmp the comparator to use to sort the eigen values
[ "Sorts", "the", "eigen", "values", "and", "the", "corresponding", "eigenvector", "columns", "by", "the", "associated", "eigen", "value", ".", "Sorting", "can", "not", "occur", "if", "complex", "values", "are", "present", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/EigenValueDecomposition.java#L692-L708
52,953
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/SGDNetworkTrainer.java
SGDNetworkTrainer.feedfoward
public Vec feedfoward(Vec x) { Vec a_lprev = x; for (int l = 0; l < layersActivation.size(); l++) { Vec z_l = new DenseVector(layerSizes[l+1]); z_l.zeroOut(); W.get(l).multiply(a_lprev, 1.0, z_l); //add the bias term back in ...
java
public Vec feedfoward(Vec x) { Vec a_lprev = x; for (int l = 0; l < layersActivation.size(); l++) { Vec z_l = new DenseVector(layerSizes[l+1]); z_l.zeroOut(); W.get(l).multiply(a_lprev, 1.0, z_l); //add the bias term back in ...
[ "public", "Vec", "feedfoward", "(", "Vec", "x", ")", "{", "Vec", "a_lprev", "=", "x", ";", "for", "(", "int", "l", "=", "0", ";", "l", "<", "layersActivation", ".", "size", "(", ")", ";", "l", "++", ")", "{", "Vec", "z_l", "=", "new", "DenseVec...
Feeds the given singular pattern through the network and computes its activations @param x the input vector to feed forward through the network @return the final activation for this network
[ "Feeds", "the", "given", "singular", "pattern", "through", "the", "network", "and", "computes", "its", "activations" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/SGDNetworkTrainer.java#L606-L624
52,954
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/neuralnetwork/SGDNetworkTrainer.java
SGDNetworkTrainer.applyDropout
private static void applyDropout(final Matrix X, final int randThresh, final Random rand, ExecutorService ex) { if (ex == null) { for (int i = 0; i < X.rows(); i++) for (int j = 0; j < X.cols(); j++) if (rand.nextInt() < randThresh) ...
java
private static void applyDropout(final Matrix X, final int randThresh, final Random rand, ExecutorService ex) { if (ex == null) { for (int i = 0; i < X.rows(); i++) for (int j = 0; j < X.cols(); j++) if (rand.nextInt() < randThresh) ...
[ "private", "static", "void", "applyDropout", "(", "final", "Matrix", "X", ",", "final", "int", "randThresh", ",", "final", "Random", "rand", ",", "ExecutorService", "ex", ")", "{", "if", "(", "ex", "==", "null", ")", "{", "for", "(", "int", "i", "=", ...
Applies dropout to the given matrix @param X the matrix to dropout values from @param randThresh the threshold that a random integer must be less than to get dropped out @param rand the source of randomness @param ex the source of threads for parlallel computation, or {@code null}
[ "Applies", "dropout", "to", "the", "given", "matrix" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/SGDNetworkTrainer.java#L778-L817
52,955
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/boosting/UpdatableStacking.java
UpdatableStacking.getPredVecR
private DataPoint getPredVecR(DataPoint data) { Vec w = new DenseVector(baseRegressors.size()); for (int i = 0; i < baseRegressors.size(); i++) w.set(i, baseRegressors.get(i).regress(data)); return new DataPoint(w); }
java
private DataPoint getPredVecR(DataPoint data) { Vec w = new DenseVector(baseRegressors.size()); for (int i = 0; i < baseRegressors.size(); i++) w.set(i, baseRegressors.get(i).regress(data)); return new DataPoint(w); }
[ "private", "DataPoint", "getPredVecR", "(", "DataPoint", "data", ")", "{", "Vec", "w", "=", "new", "DenseVector", "(", "baseRegressors", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "baseRegressors", ".", "size", ...
Gets the predicted vector wrapped in a new DataPoint from a data point assuming we are doing regression @param data the data point to get the classifier from @return the vector of predictions from each regressor
[ "Gets", "the", "predicted", "vector", "wrapped", "in", "a", "new", "DataPoint", "from", "a", "data", "point", "assuming", "we", "are", "doing", "regression" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/boosting/UpdatableStacking.java#L186-L192
52,956
EdwardRaff/JSAT
JSAT/src/jsat/utils/ClosedHashingUtil.java
ClosedHashingUtil.getNextPow2TwinPrime
public static int getNextPow2TwinPrime(int m) { int pos = Arrays.binarySearch(twinPrimesP2, m+1); if(pos >= 0) return twinPrimesP2[pos]; else return twinPrimesP2[-pos - 1]; }
java
public static int getNextPow2TwinPrime(int m) { int pos = Arrays.binarySearch(twinPrimesP2, m+1); if(pos >= 0) return twinPrimesP2[pos]; else return twinPrimesP2[-pos - 1]; }
[ "public", "static", "int", "getNextPow2TwinPrime", "(", "int", "m", ")", "{", "int", "pos", "=", "Arrays", ".", "binarySearch", "(", "twinPrimesP2", ",", "m", "+", "1", ")", ";", "if", "(", "pos", ">=", "0", ")", "return", "twinPrimesP2", "[", "pos", ...
Gets the next twin prime that is near a power of 2 and greater than or equal to the given value @param m the integer to get a twine prime larger than @return the a twin prime greater than or equal to
[ "Gets", "the", "next", "twin", "prime", "that", "is", "near", "a", "power", "of", "2", "and", "greater", "than", "or", "equal", "to", "the", "given", "value" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/ClosedHashingUtil.java#L55-L62
52,957
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.replaceNumericFeatures
public void replaceNumericFeatures(List<Vec> newNumericFeatures) { if(this.size() != newNumericFeatures.size()) throw new RuntimeException("Input list does not have the same not of dataums as the dataset"); for(int i = 0; i < newNumericFeatures.size(); i++) { ...
java
public void replaceNumericFeatures(List<Vec> newNumericFeatures) { if(this.size() != newNumericFeatures.size()) throw new RuntimeException("Input list does not have the same not of dataums as the dataset"); for(int i = 0; i < newNumericFeatures.size(); i++) { ...
[ "public", "void", "replaceNumericFeatures", "(", "List", "<", "Vec", ">", "newNumericFeatures", ")", "{", "if", "(", "this", ".", "size", "(", ")", "!=", "newNumericFeatures", ".", "size", "(", ")", ")", "throw", "new", "RuntimeException", "(", "\"Input list...
This method will replace every numeric feature in this dataset with a Vec object from the given list. All vecs in the given list must be of the same size. @param newNumericFeatures the list of new numeric features to use
[ "This", "method", "will", "replace", "every", "numeric", "feature", "in", "this", "dataset", "with", "a", "Vec", "object", "from", "the", "given", "list", ".", "All", "vecs", "in", "the", "given", "list", "must", "be", "of", "the", "same", "size", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L245-L260
52,958
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.base_add
protected void base_add(DataPoint dp, double weight) { datapoints.addDataPoint(dp); setWeight(size()-1, weight); }
java
protected void base_add(DataPoint dp, double weight) { datapoints.addDataPoint(dp); setWeight(size()-1, weight); }
[ "protected", "void", "base_add", "(", "DataPoint", "dp", ",", "double", "weight", ")", "{", "datapoints", ".", "addDataPoint", "(", "dp", ")", ";", "setWeight", "(", "size", "(", ")", "-", "1", ",", "weight", ")", ";", "}" ]
Adds a new datapoint to this set.This method is protected, as not all datasets will be satisfied by adding just a data point. @param dp the datapoint to add @param weight weight of the point to add
[ "Adds", "a", "new", "datapoint", "to", "this", "set", ".", "This", "method", "is", "protected", "as", "not", "all", "datasets", "will", "be", "satisfied", "by", "adding", "just", "a", "data", "point", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L269-L273
52,959
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.getDataPointIterator
public Iterator<DataPoint> getDataPointIterator() { Iterator<DataPoint> iteData = new Iterator<DataPoint>() { int cur = 0; int to = size(); @Override public boolean hasNext() { return cur < to; } ...
java
public Iterator<DataPoint> getDataPointIterator() { Iterator<DataPoint> iteData = new Iterator<DataPoint>() { int cur = 0; int to = size(); @Override public boolean hasNext() { return cur < to; } ...
[ "public", "Iterator", "<", "DataPoint", ">", "getDataPointIterator", "(", ")", "{", "Iterator", "<", "DataPoint", ">", "iteData", "=", "new", "Iterator", "<", "DataPoint", ">", "(", ")", "{", "int", "cur", "=", "0", ";", "int", "to", "=", "size", "(", ...
Returns an iterator that will iterate over all data points in the set. The behavior is not defined if one attempts to modify the data set while being iterated. @return an iterator for the data points
[ "Returns", "an", "iterator", "that", "will", "iterate", "over", "all", "data", "points", "in", "the", "set", ".", "The", "behavior", "is", "not", "defined", "if", "one", "attempts", "to", "modify", "the", "data", "set", "while", "being", "iterated", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L397-L424
52,960
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.getMissingDropped
public Type getMissingDropped() { List<Integer> hasNoMissing = new IntList(); for (int i = 0; i < size(); i++) { DataPoint dp = getDataPoint(i); boolean missing = dp.getNumericalValues().countNaNs() > 0; for(int c : dp.getCategoricalValues()) ...
java
public Type getMissingDropped() { List<Integer> hasNoMissing = new IntList(); for (int i = 0; i < size(); i++) { DataPoint dp = getDataPoint(i); boolean missing = dp.getNumericalValues().countNaNs() > 0; for(int c : dp.getCategoricalValues()) ...
[ "public", "Type", "getMissingDropped", "(", ")", "{", "List", "<", "Integer", ">", "hasNoMissing", "=", "new", "IntList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", "(", ")", ";", "i", "++", ")", "{", "DataPoint", "dp...
This method returns a dataset that is a subset of this dataset, where only the rows that have no missing values are kept. The new dataset is backed by this dataset. @return a subset of this dataset that has all data points with missing features dropped
[ "This", "method", "returns", "a", "dataset", "that", "is", "a", "subset", "of", "this", "dataset", "where", "only", "the", "rows", "that", "have", "no", "missing", "values", "are", "kept", ".", "The", "new", "dataset", "is", "backed", "by", "this", "data...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L500-L514
52,961
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.randomSplit
public List<Type> randomSplit(Random rand, double... splits) { if(splits.length < 1) throw new IllegalArgumentException("Input array of split fractions must be non-empty"); IntList randOrder = new IntList(size()); ListUtils.addRange(randOrder, 0, size(), 1); Collect...
java
public List<Type> randomSplit(Random rand, double... splits) { if(splits.length < 1) throw new IllegalArgumentException("Input array of split fractions must be non-empty"); IntList randOrder = new IntList(size()); ListUtils.addRange(randOrder, 0, size(), 1); Collect...
[ "public", "List", "<", "Type", ">", "randomSplit", "(", "Random", "rand", ",", "double", "...", "splits", ")", "{", "if", "(", "splits", ".", "length", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Input array of split fractions must be non-...
Splits the dataset randomly into proportionally sized partitions. @param rand the source of randomness for moving data around @param splits any array, where the length is the number of datasets to create and the value of in each index is the fraction of samples that should be placed into that dataset. The sum of value...
[ "Splits", "the", "dataset", "randomly", "into", "proportionally", "sized", "partitions", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L526-L555
52,962
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.getDataPoints
public List<DataPoint> getDataPoints() { List<DataPoint> list = new ArrayList<>(size()); for(int i = 0; i < size(); i++) list.add(getDataPoint(i)); return list; }
java
public List<DataPoint> getDataPoints() { List<DataPoint> list = new ArrayList<>(size()); for(int i = 0; i < size(); i++) list.add(getDataPoint(i)); return list; }
[ "public", "List", "<", "DataPoint", ">", "getDataPoints", "(", ")", "{", "List", "<", "DataPoint", ">", "list", "=", "new", "ArrayList", "<>", "(", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", "(", ")", "...
Creates a list containing the same DataPoints in this set. They are soft copies, in the same order as this data set. However, altering this list will have no effect on DataSet. Altering the DataPoints in the list will effect the DataPoints in this DataSet. @return a list of the DataPoints in this DataSet.
[ "Creates", "a", "list", "containing", "the", "same", "DataPoints", "in", "this", "set", ".", "They", "are", "soft", "copies", "in", "the", "same", "order", "as", "this", "data", "set", ".", "However", "altering", "this", "list", "will", "have", "no", "ef...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L608-L614
52,963
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.getDataVectors
public List<Vec> getDataVectors() { List<Vec> vecs = new ArrayList<>(size()); for(int i = 0; i < size(); i++) vecs.add(getDataPoint(i).getNumericalValues()); return vecs; }
java
public List<Vec> getDataVectors() { List<Vec> vecs = new ArrayList<>(size()); for(int i = 0; i < size(); i++) vecs.add(getDataPoint(i).getNumericalValues()); return vecs; }
[ "public", "List", "<", "Vec", ">", "getDataVectors", "(", ")", "{", "List", "<", "Vec", ">", "vecs", "=", "new", "ArrayList", "<>", "(", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", "(", ")", ";", "i", ...
Creates a list of the vectors values for each data point in the correct order. @return a list of the vectors for the data points
[ "Creates", "a", "list", "of", "the", "vectors", "values", "for", "each", "data", "point", "in", "the", "correct", "order", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L620-L626
52,964
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.setWeight
public void setWeight(int i, double w) { if(i >= size() || i < 0) throw new IndexOutOfBoundsException("Dataset has only " + size() + " members, can't access index " + i ); else if(Double.isNaN(w) || Double.isInfinite(w) || w < 0) throw new ArithmeticException("Invalid we...
java
public void setWeight(int i, double w) { if(i >= size() || i < 0) throw new IndexOutOfBoundsException("Dataset has only " + size() + " members, can't access index " + i ); else if(Double.isNaN(w) || Double.isInfinite(w) || w < 0) throw new ArithmeticException("Invalid we...
[ "public", "void", "setWeight", "(", "int", "i", ",", "double", "w", ")", "{", "if", "(", "i", ">=", "size", "(", ")", "||", "i", "<", "0", ")", "throw", "new", "IndexOutOfBoundsException", "(", "\"Dataset has only \"", "+", "size", "(", ")", "+", "\"...
Sets the weight of a given datapoint within this data set. @param i the index to change the weight of @param w the new weight value.
[ "Sets", "the", "weight", "of", "a", "given", "datapoint", "within", "this", "data", "set", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L832-L853
52,965
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.getWeight
public double getWeight(int i) { if(i >= size() || i < 0) throw new IndexOutOfBoundsException("Dataset has only " + size() + " members, can't access index " + i ); if(weights == null) return 1; else if(weights.length <= i) return 1; ...
java
public double getWeight(int i) { if(i >= size() || i < 0) throw new IndexOutOfBoundsException("Dataset has only " + size() + " members, can't access index " + i ); if(weights == null) return 1; else if(weights.length <= i) return 1; ...
[ "public", "double", "getWeight", "(", "int", "i", ")", "{", "if", "(", "i", ">=", "size", "(", ")", "||", "i", "<", "0", ")", "throw", "new", "IndexOutOfBoundsException", "(", "\"Dataset has only \"", "+", "size", "(", ")", "+", "\" members, can't access i...
Returns the weight of the specified data point @param i the data point index to get the weight of @return the weight of the requested data point
[ "Returns", "the", "weight", "of", "the", "specified", "data", "point" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L860-L870
52,966
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.getDataWeights
public Vec getDataWeights() { final int N = this.size(); if(N == 0) return new DenseVector(0); //assume everyone has the same weight until proven otherwise. double weight = getWeight(0); double[] weights_copy = null; for(int i = 1; i < N;...
java
public Vec getDataWeights() { final int N = this.size(); if(N == 0) return new DenseVector(0); //assume everyone has the same weight until proven otherwise. double weight = getWeight(0); double[] weights_copy = null; for(int i = 1; i < N;...
[ "public", "Vec", "getDataWeights", "(", ")", "{", "final", "int", "N", "=", "this", ".", "size", "(", ")", ";", "if", "(", "N", "==", "0", ")", "return", "new", "DenseVector", "(", "0", ")", ";", "//assume everyone has the same weight until proven otherwise....
This method returns the weight of each data point in a single Vector. When all data points have the same weight, this will return a vector that uses fixed memory instead of allocating a full double backed array. @return a vector that will return the weight for each data point with the same corresponding index.
[ "This", "method", "returns", "the", "weight", "of", "each", "data", "point", "in", "a", "single", "Vector", ".", "When", "all", "data", "points", "have", "the", "same", "weight", "this", "will", "return", "a", "vector", "that", "uses", "fixed", "memory", ...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L880-L907
52,967
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/ERTrees.java
ERTrees.evaluateFeatureImportance
public <Type extends DataSet> OnLineStatistics[] evaluateFeatureImportance(DataSet<Type> data, TreeFeatureImportanceInference imp) { OnLineStatistics[] importances = new OnLineStatistics[data.getNumFeatures()]; for(int i = 0; i < importances.length; i++) importances[i] = new OnLineStatis...
java
public <Type extends DataSet> OnLineStatistics[] evaluateFeatureImportance(DataSet<Type> data, TreeFeatureImportanceInference imp) { OnLineStatistics[] importances = new OnLineStatistics[data.getNumFeatures()]; for(int i = 0; i < importances.length; i++) importances[i] = new OnLineStatis...
[ "public", "<", "Type", "extends", "DataSet", ">", "OnLineStatistics", "[", "]", "evaluateFeatureImportance", "(", "DataSet", "<", "Type", ">", "data", ",", "TreeFeatureImportanceInference", "imp", ")", "{", "OnLineStatistics", "[", "]", "importances", "=", "new", ...
Measures the statistics of feature importance from the trees in this forest. @param <Type> @param data the dataset to infer the feature importance from with respect to the current model. @param imp the method of determing the feature importance that will be applied to each tree in this model @return an array of statis...
[ "Measures", "the", "statistics", "of", "feature", "importance", "from", "the", "trees", "in", "this", "forest", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/ERTrees.java#L118-L132
52,968
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/NewGLMNET.java
NewGLMNET.setC
@WarmParameter(prefLowToHigh = true) public void setC(double C) { if(C <= 0 || Double.isInfinite(C) || Double.isNaN(C)) throw new IllegalArgumentException("Regularization term C must be a positive value, not " + C); this.C = C; }
java
@WarmParameter(prefLowToHigh = true) public void setC(double C) { if(C <= 0 || Double.isInfinite(C) || Double.isNaN(C)) throw new IllegalArgumentException("Regularization term C must be a positive value, not " + C); this.C = C; }
[ "@", "WarmParameter", "(", "prefLowToHigh", "=", "true", ")", "public", "void", "setC", "(", "double", "C", ")", "{", "if", "(", "C", "<=", "0", "||", "Double", ".", "isInfinite", "(", "C", ")", "||", "Double", ".", "isNaN", "(", "C", ")", ")", "...
Sets the regularization term, where smaller values indicate a larger regularization penalty. @param C the positive regularization term
[ "Sets", "the", "regularization", "term", "where", "smaller", "values", "indicate", "a", "larger", "regularization", "penalty", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/NewGLMNET.java#L156-L162
52,969
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/NewGLMNET.java
NewGLMNET.getM_Bar_for_w0
private double getM_Bar_for_w0(int n, int l, List<Vec> columnsOfX, double[] col_neg_class_sum, double col_neg_class_sum_bias) { /** * if w=0, then D_part[i] = 0.5 for all i */ final double D_part_i = 0.5; //algo 3, Step 1. double M_bar = 0; ...
java
private double getM_Bar_for_w0(int n, int l, List<Vec> columnsOfX, double[] col_neg_class_sum, double col_neg_class_sum_bias) { /** * if w=0, then D_part[i] = 0.5 for all i */ final double D_part_i = 0.5; //algo 3, Step 1. double M_bar = 0; ...
[ "private", "double", "getM_Bar_for_w0", "(", "int", "n", ",", "int", "l", ",", "List", "<", "Vec", ">", "columnsOfX", ",", "double", "[", "]", "col_neg_class_sum", ",", "double", "col_neg_class_sum_bias", ")", "{", "/**\n * if w=0, then D_part[i] = 0.5 for a...
When we perform a warm start, we want to train to the same point that we would have if we had not done a warm start. But our stopping point is based on the initial relative error. To get around that, this method computes what the error would have been for the zero weight vector @param n @param l @param columnsOfX @para...
[ "When", "we", "perform", "a", "warm", "start", "we", "want", "to", "train", "to", "the", "same", "point", "that", "we", "would", "have", "if", "we", "had", "not", "done", "a", "warm", "start", ".", "But", "our", "stopping", "point", "is", "based", "o...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/NewGLMNET.java#L856-L899
52,970
EdwardRaff/JSAT
JSAT/src/jsat/math/OnLineStatistics.java
OnLineStatistics.add
public void add(double x, double weight) { //See http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance if(weight < 0) throw new ArithmeticException("Can not add a negative weight"); else if(weight == 0) return; double n1 = n; n+=weig...
java
public void add(double x, double weight) { //See http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance if(weight < 0) throw new ArithmeticException("Can not add a negative weight"); else if(weight == 0) return; double n1 = n; n+=weig...
[ "public", "void", "add", "(", "double", "x", ",", "double", "weight", ")", "{", "//See http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance", "if", "(", "weight", "<", "0", ")", "throw", "new", "ArithmeticException", "(", "\"Can not add a negative weight\"", ...
Adds a data sample the the counts with the provided weight of influence. @param x the data value to add @param weight the weight to give the value @throws ArithmeticException if a negative weight is given
[ "Adds", "a", "data", "sample", "the", "the", "counts", "with", "the", "provided", "weight", "of", "influence", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/OnLineStatistics.java#L107-L136
52,971
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/SBP.java
SBP.setBurnIn
public void setBurnIn(double burnIn) { if(Double.isNaN(burnIn) || burnIn < 0 || burnIn >= 1) throw new IllegalArgumentException("BurnInFraction must be in [0, 1), not " + burnIn); this.burnIn = burnIn; }
java
public void setBurnIn(double burnIn) { if(Double.isNaN(burnIn) || burnIn < 0 || burnIn >= 1) throw new IllegalArgumentException("BurnInFraction must be in [0, 1), not " + burnIn); this.burnIn = burnIn; }
[ "public", "void", "setBurnIn", "(", "double", "burnIn", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "burnIn", ")", "||", "burnIn", "<", "0", "||", "burnIn", ">=", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"BurnInFraction must be in [...
Sets the burn in fraction. SBP averages the intermediate solutions from each step as the final solution. The intermediate steps of SBP are highly correlated, and the begging solutions are usually not as meaningful toward the converged solution. To overcome this issue a certain fraction of the iterations are not average...
[ "Sets", "the", "burn", "in", "fraction", ".", "SBP", "averages", "the", "intermediate", "solutions", "from", "each", "step", "as", "the", "final", "solution", ".", "The", "intermediate", "steps", "of", "SBP", "are", "highly", "correlated", "and", "the", "beg...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/SBP.java#L132-L137
52,972
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntSetFixedSize.java
IntSetFixedSize.add
public boolean add(int e) { if(e < 0 || e >= has.length) throw new IllegalArgumentException("Input must be in range [0, " + has.length + ") not " + e); else if(contains(e) ) return false; else { if (nnz == 0) { first = e...
java
public boolean add(int e) { if(e < 0 || e >= has.length) throw new IllegalArgumentException("Input must be in range [0, " + has.length + ") not " + e); else if(contains(e) ) return false; else { if (nnz == 0) { first = e...
[ "public", "boolean", "add", "(", "int", "e", ")", "{", "if", "(", "e", "<", "0", "||", "e", ">=", "has", ".", "length", ")", "throw", "new", "IllegalArgumentException", "(", "\"Input must be in range [0, \"", "+", "has", ".", "length", "+", "\") not \"", ...
Adds a new integer into the set @param e the value to add into the set @return {@code true} if the operation modified the set, {@code false} otherwise.
[ "Adds", "a", "new", "integer", "into", "the", "set" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntSetFixedSize.java#L51-L74
52,973
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntList.java
IntList.unmodifiableView
public static List<Integer> unmodifiableView(int[] array, int length) { return Collections.unmodifiableList(view(array, length)); }
java
public static List<Integer> unmodifiableView(int[] array, int length) { return Collections.unmodifiableList(view(array, length)); }
[ "public", "static", "List", "<", "Integer", ">", "unmodifiableView", "(", "int", "[", "]", "array", ",", "int", "length", ")", "{", "return", "Collections", ".", "unmodifiableList", "(", "view", "(", "array", ",", "length", ")", ")", ";", "}" ]
Creates and returns an unmodifiable view of the given int array that requires only a small object allocation. @param array the array to wrap into an unmodifiable list @param length the number of values of the array to use, starting from zero @return an unmodifiable list view of the array
[ "Creates", "and", "returns", "an", "unmodifiable", "view", "of", "the", "given", "int", "array", "that", "requires", "only", "a", "small", "object", "allocation", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntList.java#L203-L206
52,974
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntList.java
IntList.view
public static IntList view(int[] array, int length) { if(length > array.length || length < 0) throw new IllegalArgumentException("length must be non-negative and no more than the size of the array("+array.length+"), not " + length); return new IntList(array, length); }
java
public static IntList view(int[] array, int length) { if(length > array.length || length < 0) throw new IllegalArgumentException("length must be non-negative and no more than the size of the array("+array.length+"), not " + length); return new IntList(array, length); }
[ "public", "static", "IntList", "view", "(", "int", "[", "]", "array", ",", "int", "length", ")", "{", "if", "(", "length", ">", "array", ".", "length", "||", "length", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"length must be non-ne...
Creates and returns a view of the given int array that requires only a small object allocation. Changes to the list will be reflected in the array up to a point. If the modification would require increasing the capacity of the array, a new array will be allocated - at which point operations will no longer be reflected ...
[ "Creates", "and", "returns", "a", "view", "of", "the", "given", "int", "array", "that", "requires", "only", "a", "small", "object", "allocation", ".", "Changes", "to", "the", "list", "will", "be", "reflected", "in", "the", "array", "up", "to", "a", "poin...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntList.java#L220-L225
52,975
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntList.java
IntList.range
public static IntList range(int start, int end, int step) { IntList l = new IntList((end-start)/step +1); for(int i = start; i < end; i++) l.add(i); return l; }
java
public static IntList range(int start, int end, int step) { IntList l = new IntList((end-start)/step +1); for(int i = start; i < end; i++) l.add(i); return l; }
[ "public", "static", "IntList", "range", "(", "int", "start", ",", "int", "end", ",", "int", "step", ")", "{", "IntList", "l", "=", "new", "IntList", "(", "(", "end", "-", "start", ")", "/", "step", "+", "1", ")", ";", "for", "(", "int", "i", "=...
Returns a new IntList containing values in the given range @param start the starting value (inclusive) @param end the ending value (exclusive) @param step the step size @return a new IntList populated by integer values as if having run through a for loop
[ "Returns", "a", "new", "IntList", "containing", "values", "in", "the", "given", "range" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntList.java#L260-L266
52,976
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/ConditionalProbabilityTable.java
ConditionalProbabilityTable.dataPointToCord
public int dataPointToCord(DataPointPair<Integer> dataPoint, int targetClass, int[] cord) { if(cord.length != getDimensionSize()) throw new ArithmeticException("Storage space and CPT dimension miss match"); DataPoint dp = dataPoint.getDataPoint(); int skipVal = -1; //Set ...
java
public int dataPointToCord(DataPointPair<Integer> dataPoint, int targetClass, int[] cord) { if(cord.length != getDimensionSize()) throw new ArithmeticException("Storage space and CPT dimension miss match"); DataPoint dp = dataPoint.getDataPoint(); int skipVal = -1; //Set ...
[ "public", "int", "dataPointToCord", "(", "DataPointPair", "<", "Integer", ">", "dataPoint", ",", "int", "targetClass", ",", "int", "[", "]", "cord", ")", "{", "if", "(", "cord", ".", "length", "!=", "getDimensionSize", "(", ")", ")", "throw", "new", "Ari...
Converts a data point pair into a coordinate. The paired value contains the value for the predicting index. Though this value will not be used if the predicting class of the original data set was not used to make the table. @param dataPoint the DataPointPair to convert @param targetClass the index in the original data...
[ "Converts", "a", "data", "point", "pair", "into", "a", "coordinate", ".", "The", "paired", "value", "contains", "the", "value", "for", "the", "predicting", "index", ".", "Though", "this", "value", "will", "not", "be", "used", "if", "the", "predicting", "cl...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/ConditionalProbabilityTable.java#L102-L124
52,977
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/ConditionalProbabilityTable.java
ConditionalProbabilityTable.query
public double query(int targetClass, int targetValue, int[] cord) { double sumVal = 0; double targetVal = 0; int realTargetIndex = catIndexToRealIndex[targetClass]; CategoricalData queryData = valid.get(targetClass); //Now do all other target class posibilt...
java
public double query(int targetClass, int targetValue, int[] cord) { double sumVal = 0; double targetVal = 0; int realTargetIndex = catIndexToRealIndex[targetClass]; CategoricalData queryData = valid.get(targetClass); //Now do all other target class posibilt...
[ "public", "double", "query", "(", "int", "targetClass", ",", "int", "targetValue", ",", "int", "[", "]", "cord", ")", "{", "double", "sumVal", "=", "0", ";", "double", "targetVal", "=", "0", ";", "int", "realTargetIndex", "=", "catIndexToRealIndex", "[", ...
Queries the CPT for the probability of the target class occurring with the specified value given the class values of the other attributes @param targetClass the index in the original data set of the class that we want to probability of @param targetValue the value of the <tt>targetClass</tt> that we want to probabilit...
[ "Queries", "the", "CPT", "for", "the", "probability", "of", "the", "target", "class", "occurring", "with", "the", "specified", "value", "given", "the", "class", "values", "of", "the", "other", "attributes" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/ConditionalProbabilityTable.java#L225-L248
52,978
EdwardRaff/JSAT
JSAT/src/jsat/parameters/Parameter.java
Parameter.toParameterMap
public static Map<String, Parameter> toParameterMap(List<Parameter> params) { Map<String, Parameter> map = new HashMap<String, Parameter>(params.size()); for(Parameter param : params) { if(map.put(param.getASCIIName(), param) != null) throw new RuntimeException("N...
java
public static Map<String, Parameter> toParameterMap(List<Parameter> params) { Map<String, Parameter> map = new HashMap<String, Parameter>(params.size()); for(Parameter param : params) { if(map.put(param.getASCIIName(), param) != null) throw new RuntimeException("N...
[ "public", "static", "Map", "<", "String", ",", "Parameter", ">", "toParameterMap", "(", "List", "<", "Parameter", ">", "params", ")", "{", "Map", "<", "String", ",", "Parameter", ">", "map", "=", "new", "HashMap", "<", "String", ",", "Parameter", ">", ...
Creates a map of all possible parameter names to their corresponding object. No two parameters may have the same name. @param params the list of parameters to create a map for @return a map of string names to their parameters @throws RuntimeException if two parameters have the same name
[ "Creates", "a", "map", "of", "all", "possible", "parameter", "names", "to", "their", "corresponding", "object", ".", "No", "two", "parameters", "may", "have", "the", "same", "name", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/parameters/Parameter.java#L172-L184
52,979
EdwardRaff/JSAT
JSAT/src/jsat/parameters/Parameter.java
Parameter.spaceCamelCase
private static String spaceCamelCase(String in) { StringBuilder sb = new StringBuilder(in.length()+5); for(int i = 0; i < in.length(); i++) { char c = in.charAt(i); if(Character.isUpperCase(c)) sb.append(' '); sb.append(c); } ...
java
private static String spaceCamelCase(String in) { StringBuilder sb = new StringBuilder(in.length()+5); for(int i = 0; i < in.length(); i++) { char c = in.charAt(i); if(Character.isUpperCase(c)) sb.append(' '); sb.append(c); } ...
[ "private", "static", "String", "spaceCamelCase", "(", "String", "in", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "in", ".", "length", "(", ")", "+", "5", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "in", ".", ...
Returns a version of the same string that has spaced inserted before each capital letter @param in the CamelCase string @return the spaced Camel Case string
[ "Returns", "a", "version", "of", "the", "same", "string", "that", "has", "spaced", "inserted", "before", "each", "capital", "letter" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/parameters/Parameter.java#L777-L788
52,980
EdwardRaff/JSAT
JSAT/src/jsat/datatransform/NumericalToHistogram.java
NumericalToHistogram.guessNumberOfBins
public static Distribution guessNumberOfBins(DataSet data) { if(data.size() < 20) return new UniformDiscrete(2, data.size()-1); else if(data.size() >= 1000000) return new LogUniform(50, 1000); int sqrt = (int) Math.sqrt(data.size()); return new UniformDiscrete...
java
public static Distribution guessNumberOfBins(DataSet data) { if(data.size() < 20) return new UniformDiscrete(2, data.size()-1); else if(data.size() >= 1000000) return new LogUniform(50, 1000); int sqrt = (int) Math.sqrt(data.size()); return new UniformDiscrete...
[ "public", "static", "Distribution", "guessNumberOfBins", "(", "DataSet", "data", ")", "{", "if", "(", "data", ".", "size", "(", ")", "<", "20", ")", "return", "new", "UniformDiscrete", "(", "2", ",", "data", ".", "size", "(", ")", "-", "1", ")", ";",...
Attempts to guess the number of bins to use @param data the dataset to be transforms @return a distribution of the guess
[ "Attempts", "to", "guess", "the", "number", "of", "bins", "to", "use" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/NumericalToHistogram.java#L138-L146
52,981
EdwardRaff/JSAT
JSAT/src/jsat/datatransform/WhitenedPCA.java
WhitenedPCA.getSVD
private SingularValueDecomposition getSVD(DataSet dataSet) { Matrix cov = covarianceMatrix(meanVector(dataSet), dataSet); for(int i = 0; i < cov.rows(); i++)//force it to be symmetric for(int j = 0; j < i; j++) cov.set(j, i, cov.get(i, j)); EigenValueDecomposition...
java
private SingularValueDecomposition getSVD(DataSet dataSet) { Matrix cov = covarianceMatrix(meanVector(dataSet), dataSet); for(int i = 0; i < cov.rows(); i++)//force it to be symmetric for(int j = 0; j < i; j++) cov.set(j, i, cov.get(i, j)); EigenValueDecomposition...
[ "private", "SingularValueDecomposition", "getSVD", "(", "DataSet", "dataSet", ")", "{", "Matrix", "cov", "=", "covarianceMatrix", "(", "meanVector", "(", "dataSet", ")", ",", "dataSet", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cov", "....
Gets a SVD for the covariance matrix of the data set @param dataSet the data set in question @return the SVD for the covariance
[ "Gets", "a", "SVD", "for", "the", "covariance", "matrix", "of", "the", "data", "set" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/WhitenedPCA.java#L159-L176
52,982
EdwardRaff/JSAT
JSAT/src/jsat/math/ContinuedFraction.java
ContinuedFraction.backwardNaive
public double backwardNaive(int n, double... args) { double term = getA(n, args)/getB(n,args); for(n = n-1; n >0; n--) { term = getA(n, args)/(getB(n,args)+term); } return term + getB(0, args); }
java
public double backwardNaive(int n, double... args) { double term = getA(n, args)/getB(n,args); for(n = n-1; n >0; n--) { term = getA(n, args)/(getB(n,args)+term); } return term + getB(0, args); }
[ "public", "double", "backwardNaive", "(", "int", "n", ",", "double", "...", "args", ")", "{", "double", "term", "=", "getA", "(", "n", ",", "args", ")", "/", "getB", "(", "n", ",", "args", ")", ";", "for", "(", "n", "=", "n", "-", "1", ";", "...
Approximates the continued fraction using a naive approximation @param n the number of iterations to perform @param args the values to input for the variables of the continued fraction @return an approximation of the value of the continued fraciton
[ "Approximates", "the", "continued", "fraction", "using", "a", "naive", "approximation" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/ContinuedFraction.java#L41-L51
52,983
EdwardRaff/JSAT
JSAT/src/jsat/math/ContinuedFraction.java
ContinuedFraction.lentz
public double lentz(double... args) { double f_n = getB(0, args); if(f_n == 0.0) f_n = 1e-30; double c_n, c_0 = f_n; double d_n, d_0 = 0; double delta = 0; int j = 0; while(Math.abs(delta - 1) > 1e-15) { ...
java
public double lentz(double... args) { double f_n = getB(0, args); if(f_n == 0.0) f_n = 1e-30; double c_n, c_0 = f_n; double d_n, d_0 = 0; double delta = 0; int j = 0; while(Math.abs(delta - 1) > 1e-15) { ...
[ "public", "double", "lentz", "(", "double", "...", "args", ")", "{", "double", "f_n", "=", "getB", "(", "0", ",", "args", ")", ";", "if", "(", "f_n", "==", "0.0", ")", "f_n", "=", "1e-30", ";", "double", "c_n", ",", "c_0", "=", "f_n", ";", "dou...
Uses Thompson and Barnett's modified Lentz's algorithm create an approximation that should be accurate to full precision. @param args the numeric inputs to the continued fraction @return the approximate value of the continued fraction
[ "Uses", "Thompson", "and", "Barnett", "s", "modified", "Lentz", "s", "algorithm", "create", "an", "approximation", "that", "should", "be", "accurate", "to", "full", "precision", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/ContinuedFraction.java#L60-L94
52,984
EdwardRaff/JSAT
JSAT/src/jsat/clustering/ClustererBase.java
ClustererBase.createClusterListFromAssignmentArray
public static List<List<DataPoint>> createClusterListFromAssignmentArray(int[] assignments, DataSet dataSet) { List<List<DataPoint>> clusterings = new ArrayList<>(); for(int i = 0; i < dataSet.size(); i++) { while(clusterings.size() <= assignments[i]) ...
java
public static List<List<DataPoint>> createClusterListFromAssignmentArray(int[] assignments, DataSet dataSet) { List<List<DataPoint>> clusterings = new ArrayList<>(); for(int i = 0; i < dataSet.size(); i++) { while(clusterings.size() <= assignments[i]) ...
[ "public", "static", "List", "<", "List", "<", "DataPoint", ">", ">", "createClusterListFromAssignmentArray", "(", "int", "[", "]", "assignments", ",", "DataSet", "dataSet", ")", "{", "List", "<", "List", "<", "DataPoint", ">>", "clusterings", "=", "new", "Ar...
Convenient helper method. A list of lists to represent a cluster may be desirable. In such a case, this method will take in an array of cluster assignments, and return a list of lists. @param assignments the array containing cluster assignments @param dataSet the original data set, with data in the same order as was u...
[ "Convenient", "helper", "method", ".", "A", "list", "of", "lists", "to", "represent", "a", "cluster", "may", "be", "desirable", ".", "In", "such", "a", "case", "this", "method", "will", "take", "in", "an", "array", "of", "cluster", "assignments", "and", ...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/clustering/ClustererBase.java#L35-L48
52,985
EdwardRaff/JSAT
JSAT/src/jsat/clustering/ClustererBase.java
ClustererBase.getDatapointsFromCluster
public static List<DataPoint> getDatapointsFromCluster(int c, int[] assignments, DataSet dataSet, int[] indexFrom) { List<DataPoint> list = new ArrayList<>(); int pos = 0; for(int i = 0; i < dataSet.size(); i++) if(assignments[i] == c) { list.ad...
java
public static List<DataPoint> getDatapointsFromCluster(int c, int[] assignments, DataSet dataSet, int[] indexFrom) { List<DataPoint> list = new ArrayList<>(); int pos = 0; for(int i = 0; i < dataSet.size(); i++) if(assignments[i] == c) { list.ad...
[ "public", "static", "List", "<", "DataPoint", ">", "getDatapointsFromCluster", "(", "int", "c", ",", "int", "[", "]", "assignments", ",", "DataSet", "dataSet", ",", "int", "[", "]", "indexFrom", ")", "{", "List", "<", "DataPoint", ">", "list", "=", "new"...
Gets a list of the datapoints in a data set that belong to the indicated cluster @param c the cluster ID to get the datapoints for @param assignments the array containing cluster assignments @param dataSet the data set to get the points from @param indexFrom stores the index from the original dataset that the datapoint...
[ "Gets", "a", "list", "of", "the", "datapoints", "in", "a", "data", "set", "that", "belong", "to", "the", "indicated", "cluster" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/clustering/ClustererBase.java#L61-L73
52,986
EdwardRaff/JSAT
JSAT/src/jsat/math/Complex.java
Complex.add
public Complex add(Complex c) { Complex ret = new Complex(real, imag); ret.mutableAdd(c); return ret; }
java
public Complex add(Complex c) { Complex ret = new Complex(real, imag); ret.mutableAdd(c); return ret; }
[ "public", "Complex", "add", "(", "Complex", "c", ")", "{", "Complex", "ret", "=", "new", "Complex", "(", "real", ",", "imag", ")", ";", "ret", ".", "mutableAdd", "(", "c", ")", ";", "return", "ret", ";", "}" ]
Creates a new complex number containing the resulting addition of this and another @param c the number to add @return <tt>this</tt>+c
[ "Creates", "a", "new", "complex", "number", "containing", "the", "resulting", "addition", "of", "this", "and", "another" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L98-L103
52,987
EdwardRaff/JSAT
JSAT/src/jsat/math/Complex.java
Complex.subtract
public Complex subtract(Complex c) { Complex ret = new Complex(real, imag); ret.mutableSubtract(c); return ret; }
java
public Complex subtract(Complex c) { Complex ret = new Complex(real, imag); ret.mutableSubtract(c); return ret; }
[ "public", "Complex", "subtract", "(", "Complex", "c", ")", "{", "Complex", "ret", "=", "new", "Complex", "(", "real", ",", "imag", ")", ";", "ret", ".", "mutableSubtract", "(", "c", ")", ";", "return", "ret", ";", "}" ]
Creates a new complex number containing the resulting subtracting another from this one @param c the number to subtract @return <tt>this</tt>-c
[ "Creates", "a", "new", "complex", "number", "containing", "the", "resulting", "subtracting", "another", "from", "this", "one" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L129-L134
52,988
EdwardRaff/JSAT
JSAT/src/jsat/math/Complex.java
Complex.cMul
public static void cMul(double a, double b, double c, double d, double[] results) { results[0] = a*c-b*d; results[1] = b*c+a*d; }
java
public static void cMul(double a, double b, double c, double d, double[] results) { results[0] = a*c-b*d; results[1] = b*c+a*d; }
[ "public", "static", "void", "cMul", "(", "double", "a", ",", "double", "b", ",", "double", "c", ",", "double", "d", ",", "double", "[", "]", "results", ")", "{", "results", "[", "0", "]", "=", "a", "*", "c", "-", "b", "*", "d", ";", "results", ...
Performs a complex multiplication @param a the real part of the first number @param b the imaginary part of the first number @param c the real part of the second number @param d the imaginary part of the second number @param results an array to store the real and imaginary results in. First index is the real, 2nd is t...
[ "Performs", "a", "complex", "multiplication" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L145-L149
52,989
EdwardRaff/JSAT
JSAT/src/jsat/math/Complex.java
Complex.mutableMultiply
public void mutableMultiply(double c, double d) { double newR = this.real*c-this.imag*d; double newI = this.imag*c+this.real*d; this.real = newR; this.imag = newI; }
java
public void mutableMultiply(double c, double d) { double newR = this.real*c-this.imag*d; double newI = this.imag*c+this.real*d; this.real = newR; this.imag = newI; }
[ "public", "void", "mutableMultiply", "(", "double", "c", ",", "double", "d", ")", "{", "double", "newR", "=", "this", ".", "real", "*", "c", "-", "this", ".", "imag", "*", "d", ";", "double", "newI", "=", "this", ".", "imag", "*", "c", "+", "this...
Alters this complex number as if a multiplication of another complex number was performed. @param c the real part of the other number @param d the imaginary part of the other number
[ "Alters", "this", "complex", "number", "as", "if", "a", "multiplication", "of", "another", "complex", "number", "was", "performed", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L156-L162
52,990
EdwardRaff/JSAT
JSAT/src/jsat/math/Complex.java
Complex.multiply
public Complex multiply(Complex c) { Complex ret = new Complex(real, imag); ret.mutableMultiply(c); return ret; }
java
public Complex multiply(Complex c) { Complex ret = new Complex(real, imag); ret.mutableMultiply(c); return ret; }
[ "public", "Complex", "multiply", "(", "Complex", "c", ")", "{", "Complex", "ret", "=", "new", "Complex", "(", "real", ",", "imag", ")", ";", "ret", ".", "mutableMultiply", "(", "c", ")", ";", "return", "ret", ";", "}" ]
Creates a new complex number containing the resulting multiplication between this and another @param c the number to multiply by @return <tt>this</tt>*c
[ "Creates", "a", "new", "complex", "number", "containing", "the", "resulting", "multiplication", "between", "this", "and", "another" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L178-L183
52,991
EdwardRaff/JSAT
JSAT/src/jsat/math/Complex.java
Complex.mutableDivide
public void mutableDivide(double c, double d) { final double[] r = new double[2]; cDiv(real, imag, c, d, r); this.real = r[0]; this.imag = r[1]; }
java
public void mutableDivide(double c, double d) { final double[] r = new double[2]; cDiv(real, imag, c, d, r); this.real = r[0]; this.imag = r[1]; }
[ "public", "void", "mutableDivide", "(", "double", "c", ",", "double", "d", ")", "{", "final", "double", "[", "]", "r", "=", "new", "double", "[", "2", "]", ";", "cDiv", "(", "real", ",", "imag", ",", "c", ",", "d", ",", "r", ")", ";", "this", ...
Alters this complex number as if a division by another complex number was performed. @param c the real part of the other number @param d the imaginary part of the other number
[ "Alters", "this", "complex", "number", "as", "if", "a", "division", "by", "another", "complex", "number", "was", "performed", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L249-L255
52,992
EdwardRaff/JSAT
JSAT/src/jsat/math/Complex.java
Complex.divide
public Complex divide(Complex c) { Complex ret = new Complex(real, imag); ret.mutableDivide(c); return ret; }
java
public Complex divide(Complex c) { Complex ret = new Complex(real, imag); ret.mutableDivide(c); return ret; }
[ "public", "Complex", "divide", "(", "Complex", "c", ")", "{", "Complex", "ret", "=", "new", "Complex", "(", "real", ",", "imag", ")", ";", "ret", ".", "mutableDivide", "(", "c", ")", ";", "return", "ret", ";", "}" ]
Creates a new complex number containing the resulting division of this by another @param c the number to divide by @return <tt>this</tt>/c
[ "Creates", "a", "new", "complex", "number", "containing", "the", "resulting", "division", "of", "this", "by", "another" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L273-L278
52,993
EdwardRaff/JSAT
JSAT/src/jsat/driftdetectors/ADWIN.java
ADWIN.setDelta
public void setDelta(double delta) { if(delta <= 0 || delta >= 1 || Double.isNaN(delta)) throw new IllegalArgumentException("delta must be in (0,1), not " + delta); this.delta = delta; }
java
public void setDelta(double delta) { if(delta <= 0 || delta >= 1 || Double.isNaN(delta)) throw new IllegalArgumentException("delta must be in (0,1), not " + delta); this.delta = delta; }
[ "public", "void", "setDelta", "(", "double", "delta", ")", "{", "if", "(", "delta", "<=", "0", "||", "delta", ">=", "1", "||", "Double", ".", "isNaN", "(", "delta", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"delta must be in (0,1), not \""...
Sets the upper bound on the false positive rate for detecting concept drifts @param delta the upper bound on false positives in (0,1)
[ "Sets", "the", "upper", "bound", "on", "the", "false", "positive", "rate", "for", "detecting", "concept", "drifts" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/driftdetectors/ADWIN.java#L98-L103
52,994
EdwardRaff/JSAT
JSAT/src/jsat/driftdetectors/ADWIN.java
ADWIN.compress
private void compress() { //compress ListIterator<OnLineStatistics> listIter = windows.listIterator(); double lastSizeSeen = -Double.MAX_VALUE; int lastSizeCount = 0; while(listIter.hasNext()) { OnLineStatistics window = listIter.next(); ...
java
private void compress() { //compress ListIterator<OnLineStatistics> listIter = windows.listIterator(); double lastSizeSeen = -Double.MAX_VALUE; int lastSizeCount = 0; while(listIter.hasNext()) { OnLineStatistics window = listIter.next(); ...
[ "private", "void", "compress", "(", ")", "{", "//compress", "ListIterator", "<", "OnLineStatistics", ">", "listIter", "=", "windows", ".", "listIterator", "(", ")", ";", "double", "lastSizeSeen", "=", "-", "Double", ".", "MAX_VALUE", ";", "int", "lastSizeCount...
Compresses the current window
[ "Compresses", "the", "current", "window" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/driftdetectors/ADWIN.java#L200-L231
52,995
EdwardRaff/JSAT
JSAT/src/jsat/clustering/hierarchical/DivisiveLocalClusterer.java
DivisiveLocalClusterer.computeSubClusterSplit
private void computeSubClusterSplit(final int[][] subDesignation, int originalCluster, List<DataPoint> listOfDataPointsInCluster, DataSet fullDataSet, int[] fullDesignations, final int[][] originalPositions, final double[] splitEvaluation, PriorityQueue<Integer> cluste...
java
private void computeSubClusterSplit(final int[][] subDesignation, int originalCluster, List<DataPoint> listOfDataPointsInCluster, DataSet fullDataSet, int[] fullDesignations, final int[][] originalPositions, final double[] splitEvaluation, PriorityQueue<Integer> cluste...
[ "private", "void", "computeSubClusterSplit", "(", "final", "int", "[", "]", "[", "]", "subDesignation", ",", "int", "originalCluster", ",", "List", "<", "DataPoint", ">", "listOfDataPointsInCluster", ",", "DataSet", "fullDataSet", ",", "int", "[", "]", "fullDesi...
Takes the data set and computes the clustering of a sub cluster, and stores its information, and places the result in the queue @param subDesignation the array of arrays to store the designation array for the sub clustering @param originalCluster the originalCluster that we want to store the split information of @para...
[ "Takes", "the", "data", "set", "and", "computes", "the", "clustering", "of", "a", "sub", "cluster", "and", "stores", "its", "information", "and", "places", "the", "result", "in", "the", "queue" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/clustering/hierarchical/DivisiveLocalClusterer.java#L168-L196
52,996
EdwardRaff/JSAT
JSAT/src/jsat/math/DescriptiveStatistics.java
DescriptiveStatistics.sampleCorCoeff
public static double sampleCorCoeff(Vec xData, Vec yData) { if(yData.length() != xData.length()) throw new ArithmeticException("X and Y data sets must have the same length"); double xMean = xData.mean(); double yMean = yData.mean(); double topSum = 0; for(int i...
java
public static double sampleCorCoeff(Vec xData, Vec yData) { if(yData.length() != xData.length()) throw new ArithmeticException("X and Y data sets must have the same length"); double xMean = xData.mean(); double yMean = yData.mean(); double topSum = 0; for(int i...
[ "public", "static", "double", "sampleCorCoeff", "(", "Vec", "xData", ",", "Vec", "yData", ")", "{", "if", "(", "yData", ".", "length", "(", ")", "!=", "xData", ".", "length", "(", ")", ")", "throw", "new", "ArithmeticException", "(", "\"X and Y data sets m...
Computes the sample correlation coefficient for two data sets X and Y. The lengths of X and Y must be the same, and each element in X should correspond to the element in Y. @param yData the Y data set @param xData the X data set @return the sample correlation coefficient
[ "Computes", "the", "sample", "correlation", "coefficient", "for", "two", "data", "sets", "X", "and", "Y", ".", "The", "lengths", "of", "X", "and", "Y", "must", "be", "the", "same", "and", "each", "element", "in", "X", "should", "correspond", "to", "the",...
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/DescriptiveStatistics.java#L20-L37
52,997
EdwardRaff/JSAT
JSAT/src/jsat/datatransform/LinearTransform.java
LinearTransform.setRange
public void setRange(double A, double B) { if(A == B) throw new RuntimeException("Values must be different"); else if(B > A) { double tmp = A; A = B; B = tmp; } this.A = A; this.B = B; }
java
public void setRange(double A, double B) { if(A == B) throw new RuntimeException("Values must be different"); else if(B > A) { double tmp = A; A = B; B = tmp; } this.A = A; this.B = B; }
[ "public", "void", "setRange", "(", "double", "A", ",", "double", "B", ")", "{", "if", "(", "A", "==", "B", ")", "throw", "new", "RuntimeException", "(", "\"Values must be different\"", ")", ";", "else", "if", "(", "B", ">", "A", ")", "{", "double", "...
Sets the min and max value to scale the data to. If given in the wrong order, this method will swap them @param A the maximum value for the transformed data set @param B the minimum value for the transformed data set
[ "Sets", "the", "min", "and", "max", "value", "to", "scale", "the", "data", "to", ".", "If", "given", "in", "the", "wrong", "order", "this", "method", "will", "swap", "them" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/LinearTransform.java#L94-L106
52,998
EdwardRaff/JSAT
JSAT/src/jsat/distributions/multivariate/ProductKDE.java
ProductKDE.queryWork
private double queryWork(Vec x, Set<Integer> validIndecies, SparseVector logProd) { if(originalVecs == null) throw new UntrainedModelException("Model has not yet been created, queries can not be perfomed"); double logH = 0; for(int i = 0; i < sortedDimVals.length; i++) { ...
java
private double queryWork(Vec x, Set<Integer> validIndecies, SparseVector logProd) { if(originalVecs == null) throw new UntrainedModelException("Model has not yet been created, queries can not be perfomed"); double logH = 0; for(int i = 0; i < sortedDimVals.length; i++) { ...
[ "private", "double", "queryWork", "(", "Vec", "x", ",", "Set", "<", "Integer", ">", "validIndecies", ",", "SparseVector", "logProd", ")", "{", "if", "(", "originalVecs", "==", "null", ")", "throw", "new", "UntrainedModelException", "(", "\"Model has not yet been...
Performs the main work for performing a density query. @param x the query vector @param validIndecies the empty set that will be altered to contain the indices of vectors that had a non zero contribution to the density @param logProd an empty sparce vector that will be modified to contain the log of the product of the...
[ "Performs", "the", "main", "work", "for", "performing", "a", "density", "query", "." ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/multivariate/ProductKDE.java#L131-L174
52,999
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/ExtraTree.java
ExtraTree.fillList
static private <T> void fillList(final int listsToAdd, Stack<List<T>> reusableLists, List<List<T>> aSplit) { for(int j = 0; j < listsToAdd; j++) if(reusableLists.isEmpty()) aSplit.add(new ArrayList<>()); else aSplit.add(reusableLists.pop()); }
java
static private <T> void fillList(final int listsToAdd, Stack<List<T>> reusableLists, List<List<T>> aSplit) { for(int j = 0; j < listsToAdd; j++) if(reusableLists.isEmpty()) aSplit.add(new ArrayList<>()); else aSplit.add(reusableLists.pop()); }
[ "static", "private", "<", "T", ">", "void", "fillList", "(", "final", "int", "listsToAdd", ",", "Stack", "<", "List", "<", "T", ">", ">", "reusableLists", ",", "List", "<", "List", "<", "T", ">", ">", "aSplit", ")", "{", "for", "(", "int", "j", "...
Add lists to a list of lists @param <T> the content type of the list @param listsToAdd the number of lists to add @param reusableLists available pre allocated lists for reuse @param aSplit the list of lists to add to
[ "Add", "lists", "to", "a", "list", "of", "lists" ]
0ff53b7b39684b2379cc1da522f5b3a954b15cfb
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/ExtraTree.java#L554-L561