This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| class MF(): | |
| def __init__(self, R, K, alpha, beta, iterations): | |
| """ | |
| Perform matrix factorization to predict empty | |
| entries in a matrix. | |
| Arguments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static float getDuration(File file) throws Exception { | |
| AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(file); | |
| AudioFormat format = audioInputStream.getFormat(); | |
| long audioFileLength = file.length(); | |
| int frameSize = format.getFrameSize(); | |
| float frameRate = format.getFrameRate(); | |
| float durationInSeconds = (audioFileLength / (frameSize * frameRate)); | |
| return (durationInSeconds); | |
| } |