I'm building a machine learning model in pytorch to find patterns in unstructured data. The data is in the form of files(log files). My question is can anyone tell me or show me a resource that can show me how I can convert this data into tensors or numeric data for the model, I have copied a small amount of the data I have as an example, thank you, this is my first post on stack overflow so I hope I didn't sound to confusing, thank you again for any help.
Mozilla/5.0 (Android 10; Mobile; rv:100.0) Gecko/100.0 Firefox/100.0
Mozilla/5.0 (Android 10; Mobile; rv:85.0) Gecko/85.0 Firefox/85.0
Mozilla/5.0 (Android 10; Mobile; rv:91.0) Gecko/91.0 Firefox/91.0
Mozilla/5.0 (Android 10; Mobile; rv:92.0) Gecko/92.0 Firefox/92.0
Mozilla/5.0 (Android 10; Mobile; rv:93.0) Gecko/93.0 Firefox/93.0
Mozilla/5.0 (Android 10; Mobile; rv:96.0) Gecko/96.0 Firefox/96.0
Mozilla/5.0 (Android 10; Mobile; rv:97.0) Gecko/97.0 Firefox/97.0
Mozilla/5.0 (Android 10; Mobile; rv:98.0) Gecko/98.0 Firefox/98.0
Mozilla/5.0 (Android 10; Mobile; rv:99.0) Gecko/99.0 Firefox/99.0
Mozilla/5.0 (Android 11; Mobile; rv:100.0) Gecko/100.0 Firefox/100.0
Mozilla/5.0 (Android 11; Mobile; rv:93.0) Gecko/93.0 Firefox/93.0
Mozilla/5.0 (Android 11; Mobile; rv:96.0) Gecko/96.0 Firefox/96.0
Mozilla/5.0 (Android 11; Mobile; rv:97.0) Gecko/97.0 Firefox/97.0
Mozilla/5.0 (Android 11; Mobile; rv:98.0) Gecko/98.0 Firefox/98.0
Mozilla/5.0 (Android 11; Mobile; rv:99.0) Gecko/99.0 Firefox/99.0
Mozilla/5.0 (Android 12; Mobile; rv:100.0) Gecko/100.0 Firefox/100.0
Mozilla/5.0 (Android 12; Mobile; rv:85.0) Gecko/85.0 Firefox/85.0
Mozilla/5.0 (Android 12; Mobile; rv:96.0) Gecko/96.0 Firefox/96.0
Mozilla/5.0 (Android 12; Mobile; rv:97.0) Gecko/97.0 Firefox/97.0
Mozilla/5.0 (Android 12; Mobile; rv:98.0) Gecko/98.0 Firefox/98.0
Mozilla/5.0 (Android 12; Mobile; rv:99.0) Gecko/99.0 Firefox/99.0
Mozilla/5.0 (Android 4.2.1; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0
Mozilla/5.0 (Android 4.2.2; Tablet; rv:68.0) Gecko/68.0 Firefox/68.0
Mozilla/5.0 (Android 4.3; Tablet; rv:43.0) Gecko/43.0 Firefox/43.0
Mozilla/5.0 (Android 6.0.1; Mobile; rv:99.0) Gecko/99.0 Firefox/99.0
Mozilla/5.0 (Android 7.0; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0
Mozilla/5.0 (Android 7.0; Mobile; rv:98.0) Gecko/98.0 Firefox/98.0
Mozilla/5.0 (Android 7.0; Mobile; rv:99.0) Gecko/99.0 Firefox/99.0
Mozilla/5.0 (Android 8.0.0; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0
Mozilla/5.0 (Android 8.0.0; Mobile; rv:86.0) Gecko/86.0 Firefox/86.0
Mozilla/5.0 (Android 8.0.0; Mobile; rv:98.0) Gecko/98.0 Firefox/98.0
Mozilla/5.0 (Android 8.1.0; Mobile; rv:94.0) Gecko/94.0 Firefox/94.0
Mozilla/5.0 (Android 8.1.0; Mobile; rv:97.0) Gecko/97.0 Firefox/97.0
Mozilla/5.0 (Android 8.1.0; Mobile; rv:99.0) Gecko/99.0 Firefox/99.0
Mozilla/5.0 (Android 9; Mobile; rv:91.0) Gecko/91.0 Firefox/91.0
Mozilla/5.0 (Android 9; Mobile; rv:94.0) Gecko/94.0 Firefox/94.0
Mozilla/5.0 (Android 9; Mobile; rv:96.0) Gecko/96.0 Firefox/96.0
Mozilla/5.0 (Android 9; Mobile; rv:98.0) Gecko/98.0 Firefox/98.0
Mozilla/5.0 (Android 9; Mobile; rv:99.0) Gecko/99.0 Firefox/99.0
Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML like Gecko) Chrome/100.0.4896.127 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML like Gecko) Chrome/100.0.4896.60 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML like Gecko) Chrome/100.0.4896.79 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML like Gecko) Chrome/101.0.4951.41 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML like Gecko) Version/4.0 Chrome/99.0.4844.88 Mobile DuckDuckGo/5 Safari/537.36
Mozilla/5.0 (Linux; Android 10.0; A37) AppleWebKit/537.36 (KHTML like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 10.0; P40 Pro) AppleWebKit/537.36 (KHTML like Gecko) Chrome/99.0.4844.73 Mobile Safari/537.36
Related
I am using the below piece of code for computing free RAM in iphone.
size_t get_free_memory(void)
{
mach_port_t host_port;
mach_msg_type_number_t host_size;
vm_size_t pagesize;
host_port = mach_host_self();
host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
host_page_size(host_port, &pagesize);
vm_statistics_data_t vm_stat;
if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS)
{
NSLog(#"Failed to fetch vm statistics");
return 0;
}
/* Stats in bytes */
size_t mem_free = vm_stat.free_count * pagesize;
return mem_free;
}
Although, the above code works in iOS also but host_statistics is macOS ONLY supported API.
The official Apple documentation doesn't say anything about the API being officially supported
in iOS.
My question, is there another way to compute the free and used RAM in iphone?
printfn "%A" [1..1000]
inside f# interactive shows
[1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22;
23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36; 37; 38; 39; 40; 41; 42;
43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 56; 57; 58; 59; 60; 61; 62;
63; 64; 65; 66; 67; 68; 69; 70; 71; 72; 73; 74; 75; 76; 77; 78; 79; 80; 81; 82;
83; 84; 85; 86; 87; 88; 89; 90; 91; 92; 93; 94; 95; 96; 97; 98; 99; 100; ...]
the following settings do not affect the number of list members shown
fsi.PrintSize <- 222 // no effect
fsi.PrintLength <- 222 // no effect
fsi.PrintDepth <- 222 // no effect
fsi.PrintWidth <- 222 // no effect
fsi.ShowIEnumerable <- true // no effect
Is it possible to configure the number of members shown inside f# interactive?
Is it possible t configure this such that (sprintf "%A") considers it outside of f# interactive?
i am asking this because i pretty print records, and currently some of the values are truncated. so the issue on top is to pretty print records without truncated values - just for context.
%A formatting has nice advantages as it nicely layouts records, which i do not want to loose by using StructuredFormatDisplayAttribute.
this formatting is part of formatting a large object with %A, which works perfectly, nicely without any effort. so i am not asking about really printing an isolated list.
inside the f# source:
checked the source code at https://github.com/dotnet/fsharp/blob/b23b2a0f99f12ece94c5ad89aabb9169d51091f3/src/fsharp/utils/sformat.fs
ObjectGraphFormatter apparently does the formatting, accepting format options.
the very last lines might be calling it:
let internal anyToStringForPrintf options (bindingFlags:BindingFlags) (value, typValue) =
let formatter = ObjectGraphFormatter(options, bindingFlags)
formatter.Format (ShowAll, value, typValue) |> layout_to_string options
which is called by toe core Printf module which in turn is internal.
I think I would just do this:
[1..1000]
|> List.take 50
|> List.iter (printf "%A;")
I have a TitanXP installed in a Windows 10 64bit with CUDA 9.2 and Nvidia driver (398.82-desktop-win10-64bit-international-whql), and I have a simple program which uses unified memory like below.
// CUDA kernel to add elements of two arrays
__global__
void add(int n, float *x, float *y)
{
int index = blockIdx.x * blockDim.x + threadIdx.x;
int stride = blockDim.x * gridDim.x;
for (int i = index; i < n; i += stride)
y[i] = x[i] + y[i];
}
int main(void)
{
int N = 1 << 20;
float *x, *y;
// Allocate Unified Memory -- accessible from CPU or GPU
cudaMallocManaged(&x, N * sizeof(float));
cudaMallocManaged(&y, N * sizeof(float));
// initialize x and y arrays on the host
for (int i = 0; i < N; i++) {
x[i] = 1.0f;
y[i] = 2.0f;
}
// Launch kernel on 1M elements on the GPU
int blockSize = 256;
int numBlocks = (N + blockSize - 1) / blockSize;
add <<< numBlocks, blockSize >>>(N, x, y);
// Wait for GPU to finish before accessing on host
cudaDeviceSynchronize();
// Check for errors (all values should be 3.0f)
float maxError = 0.0f;
for (int i = 0; i < N; i++)
maxError = fmax(maxError, fabs(y[i] - 3.0f));
std::cout << "Max error: " << maxError << std::endl;
// Free memory
cudaFree(x);
cudaFree(y);
return 0;
}
I compile this code using Visual Studio 2017 community, and run it in the command prompt window with no error.
When I profile it in Nvidia Profiler, it gives me a "Warning" message as below.
"==852== Warning: Unified Memory Profiling is not supported on the
current configuration because a pair of devices without peer-to-peer
support is detected on this multi-GPU setup. When peer mappings are
not available, system falls back to using zero-copy memory. It can
cause kernels, which access unified memory, to run slower. More
details can be found at:
http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#um-
managed-memory"
I am pretty sure I only have one GPU installed in the computer, why I can not get the unified memory profiling information?
By the way, I did the exactly same experiment in my another machine which has the same software environment and same GPU, and the profiler does show the unified memory information. Is there any wrong with that specific computer? Is there any hardware related configuration/setting I need to do in order to enable the unified memory feature?
I had faced this problem in the past, but after updating my driver to the last version (Released in 19/9/2018 if I am not mistaken) the problem resolved.
Hope it will resolve your problem as well.
Let me know if it did.
I install the new cuda sdk 10, and it works fine now.
It looks like starting with iOS 10.2, Apple has now prevented access to all MAC addresses, not just the one of your own device.
However, there are some apps in the store that seem to manage that still, .e.g Fing and Net Analyzer. Are these still working because they were compiled against an older SDK or do they have special tricks to gather the MAC address?
Can anyone share a work-around to get the MAC addresses for iOS 10.2 devices on WiFi?
This is only test code, just to give an idea for how to get the Mac address. But I am sure Apple will soon close this option.
-(void) jan_mac_addr_test:(const char*) host
{
#define BUFLEN (sizeof(struct rt_msghdr) + 512)
#define SEQ 9999
#define RTM_VERSION 5 // important, version 2 does not return a mac address!
#define RTM_GET 0x4 // Report Metrics
#define RTF_LLINFO 0x400 // generated by link layer (e.g. ARP)
#define RTF_IFSCOPE 0x1000000 // has valid interface scope
#define RTA_DST 0x1 // destination sockaddr present
int sockfd;
unsigned char buf[BUFLEN];
unsigned char buf2[BUFLEN];
ssize_t n;
struct rt_msghdr *rtm;
struct sockaddr_in *sin;
memset(buf,0,sizeof(buf));
memset(buf2,0,sizeof(buf2));
sockfd = socket(AF_ROUTE, SOCK_RAW, 0);
rtm = (struct rt_msghdr *) buf;
rtm->rtm_msglen = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in);
rtm->rtm_version = RTM_VERSION;
rtm->rtm_type = RTM_GET;
rtm->rtm_addrs = RTA_DST;
rtm->rtm_flags = RTF_LLINFO;
rtm->rtm_pid = 1234;
rtm->rtm_seq = SEQ;
sin = (struct sockaddr_in *) (rtm + 1);
sin->sin_len = sizeof(struct sockaddr_in);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = inet_addr(host);
write(sockfd, rtm, rtm->rtm_msglen);
n = read(sockfd, buf2, BUFLEN);
if (n != 0) {
int index = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_inarp) + 8;
// savedata("test",buf2,n);
NSLog(#"IP %s :: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",host,buf2[index+0], buf2[index+1], buf2[index+2], buf2[index+3], buf2[index+4], buf2[index+5]);
}
}
http://social.msdn.microsoft.com/Forums/vstudio/en-US/7e952c45-2494-4650-aa61-89d5ea21f1f3/how-to-use-qr-decomposition-of-extreme-optimization
How to use QR decomposition of Extreme optimization
No parameterless constructor defined for this object.
let TwelvePalace : float[,] = Array2D.zeroCreate 4 3
TwelvePalace.[0,0] <- 1.0;
TwelvePalace.[0,1] <- 2.0;
TwelvePalace.[0,2] <- 3.0;
TwelvePalace.[1,0] <- 4.0;
TwelvePalace.[1,1] <- 5.0;
TwelvePalace.[1,2] <- 6.0;
TwelvePalace.[2,0] <- 7.0;
TwelvePalace.[2,1] <- 8.0;
TwelvePalace.[2,2] <- 9.0;
TwelvePalace.[3,0] <- 10.0;
TwelvePalace.[3,1] <- 11.0;
TwelvePalace.[3,2] <- 12.0;
let mutable iii = DenseMatrix.Create(TwelvePalace)
let QRProvider : QRDecomposition = iii.GetQRDecomposition()
let Q : DenseMatrix = QRProvider.OrthogonalFactor.ToDenseMatrix() // error here
let R : DenseMatrix = QRProvider.UpperTriangularFactor.ToDenseMatrix()